>>> 0 < 10 != 1 < 5
True
Why is it?? 0<10 is true. 1<5 is also true.True != True should be false . Then why the the output is True ???
>>> 0 < 10 != 1 < 5
True
Why is it?? 0<10 is true. 1<5 is also true.True != True should be false . Then why the the output is True ???
Because of operations priorities meaning of your expression is different. You need to put parentheses: (0 < 10) != (1 < 5)
, to have what you want.
Otherwise your original expression means same as (0 < 10) and (10 != 1) and (1 < 5)
which is not what you expected. (thanks to @TomKarzes)