My trainee just reached out to me and asked why False == False != True evaluates to
True in Python, but false in JavaScript.
I think that statement is false / False, no matter how you solve it, it spits out False in my head.
Heres the breakdown:
given:
False == False != True
#Case 1:
False == False => True
True != True => False
#Case 2:
False != True => True
False == True => False

Am I missing something obvious? I tried JS with != and === but since the type is the same, it keeps the same ouput.
In Python, you have chained comparisons
This is usually intuitive for cases like a < b < c, but in that case, it gives that pretty unintuitive result. You need to parse
False == False != True
as
(False == False) and (False != True)
which then evaluates to True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With