0
Booleans
print(1 == 1 and 2 == 2) print(2 == 2 or 3 == 4) print(2 < 1 not 3 > 6) File "..\Playground\", line 7 print(2 < 1 not 3 > 6) ^ SyntaxError: invalid syntax Why do I get an error?
2 Réponses
+ 7
You can't use the 'not' operator to chain two conditions, which is why you have two different conditions in the third if-statement, which is not valid.
'not' is used to reverse one condition, however, if you want to chain two or more conditions, use 'and' or 'or' as you did in the first two statements.
+ 1
Because not operate on single operand not two.