Can someone explain to me what python is doing here?
python
Solution
This is a chained comparison (see here in the docs), the same way that
>>> 1 < 2 < 3
True
is
>>> (1 < 2) and (2 < 3)
True
In this case, we have
>>> 3 > 2 == True
False
because
>>> (3 > 2) and (2 == True)
False
because
>>> (3 > 2), (2 == True)
(True, False)
Problem
``` >>> 3 > 2 == True False #say what? >>> (3 > 2) == True True >>> 3 > (2 == True) True >>> 3 > 1 == True True >>> 3 > False True ``` What is Python doing in its godforsaken hidden logics that makes that first statement `False`, while the rest are `True`?