Issue
The following expression is evaluated to True
In [1]: not(True) == False
Out[2]: True
However, changing the order of evaluation returns a strange result!
In [3]: False == not(True)
File "<stdin>", line 1
(False == not(True))
^
SyntaxError: invalid syntax
What am I doing wrong?
Solution
You have to use the below code:
>>> False == (not True)
True
>>>
Because the code runs from left to right, so it would first run False == not
which is a SyntaxError
.
>>> False == not
SyntaxError: invalid syntax
>>>
Answered By - U12-Forward
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.