I am confused on how does the != operator works in python. I am new to python programming.
I know simple !=
simply checks whether the LHS expression and RHS expression are not equal.
for eg:
True != False
returns True
.
My question is how it works in series of !=
operators.
e.g.: when I type
-5 != False != True != True
in my python interactive session it returns False
, but if I solve it step by step I get the answer True
.
Solving it step by step:
-5 != False
returns True
True != True
returns False
False != True
returns True
So it should return True
but it returns False
. I don't know why.