0
why True==3<5 is False
3 Answers
+ 4
Look at operator precedence and short-circuit boolean, through 'comparisons':
https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not
Here's a hint (add to Ryne's answer):
>>> True==3
False
>>> 3<5
True
>>> True==3<5
False
>>> (True==3)<5
True
>>> True==(3<5)
True
>>> False==True
False
>>> False==False<True
True
>>> False==(False<True)
False
+ 1
I think I figured it out, but this might just be a coincidence.
True==3<5 is the same as writing True==3 and 3<5. In this case, since True==3 is not true, the whole and statement will be false.
0
That's weird. If anyone knows, let me know too