Confuse getting wrong even answer is write

this is code cadmy exercise

We cannot see your work so you will need to post the code for us to have a look at it.

This topic touches on the question. Have a look and see it that doesn’t help you along.