syntaxError_cheatsheet

I can’t understand how the syntax error example in the cheatsheet work. can somebody help me with that. thank you
.
.
“A SyntaxError is reported by the Python interpreter when some portion of the code is incorrect. This can include misspelled keywords, missing or too many brackets or parenthesis, incorrect operators, missing or too many quotation marks, or other conditions.”

Capture

Hey there @existingpal!! Welcome to the forums :grinning:

This line of code throws an error due to the second assignment operator =.

Since age is already being assigned the value of 5 + 4, the second = is attempting to assign 7 + 5 as 4, which can’t be done.


If, however, you used the equality operator ==, than you could assign age as a boolean value:

age = 7 + 5 == 4
# age is equal to False

Though I am not sure if you have gotten to conditionals yet, so you may not want to worry about that example.

2 Likes

thank you so much appreciate it … :ok_hand: :grinning:

1 Like