Why is my indented code returning a syntax error?

I’m wondering why I’m getting a syntax error with this code. I thought it was fine to have code indented as I have in previous tasks.
Screenshot from 2021-07-26 21-08-03

The elif and else lines need to be indented at the same level as the if line to tell the complier that they’re all one flow of logic (otherwise the compiler goes to the if block, and inside that block finds an elif block which isn’t attached to an if block).


Thank you for the explanation.

1 Like