0
Why print(2 > 4 == 4) is False? Please kindly explain me.
4 Respuestas
+ 4
Adding :
> , == have equal precedence so evaluation happens left to right..
So first > evaluared . next == . so
+ 2
Because 2 > 4 = False means 0
So 0 == 4 False
+ 1
You will need to prioritize the 4 == 4 equality check to achieve a True result.
2 > ( 4 == 4 )
2 > ( True )
2 > 1
True
+ 1
Because,
True = 1
False = 0
2 > 4, False so its value equals to 0
Now,
0 == 4, False
And also interpreter reads the code from left to right.