Today I encountered a difficult situation in this Python program:
a = [False, True]
x = True in a in a
y = True in a in [a]
z = True in a in (a)
print(x, y, z)
The output of this code is
False True False
How is it possible?
Let's test for x here:
x = True in a in a
True in [False, True] is True, and again True in [False, True] is True.
So x should be True. But when I run the program it says False.
And now let's come from right to left:
x = True in a in a
[False, True] in [False, True] is False, so now True in False might be a type error or some other error.
Could you please explain this?