Help! what's wrong with my code?

Hi everyone, I’m a beginner at Python and taking an online course. I submitted a task like below but the system always said it was wrong. Would anyone help me to check what is wrong? I checked 3 times but I still have no clue… so frustrated :frowning:

Many thanks

Please post code as text inline instead of as a screenshot. Likewise
with any program output. There’s a </> button in the compose bar to
help with this.

The question’s a little loosely worded. The final task says: “If the age
is valid, negate the variable can-drive and assign the result to a new
variable cannot_drive.” That does seem to be nearly what you’ve done.

However I expect they mean to negate can_drive itself so that it is no
longer False. Then as a separate step, regardless of whether
can_drive is true or false, I’d define cannot_drive as you have: to
always be not can_drive.

Have a think about how you’d do that - your code is very close.

1 Like

It’s REALLY loosely worded, but yeah, I’d be thinking the same as you are. Which results in a weird set of variables at the end. But, if that’s what the instructor’s looking for, so be it.

1 Like

Thank you Cameron.
It’s the first time I post something. I will follow your suggestion next time

  1. Please edit your original post and post actual code in between code brackets so we can copy and paste it to run it.
  2. What development environment are you using? Is it Google Colab? Jupyter?
  3. What is the error you are getting? If no error what is the bad result you are getting?

I think there’s no error, you’re doing exactly what the instruction says, and your code is valid. It’s either the instruction is unclear, or their test code is faulty.

I’d just move on to the next question, if I were you.