I wrote a code
print(False>True)
print(True>False)
result are
False
True
can someone explain me what is this happening
In Python, when you use booleans in a greater/lower than comparison they are automatically considered as numbers, so True
becomes 1
and False
becomes 0
. Replace them and the answer becomes obvious:
print(0 > 1)
print(1 > 0)
The first check is False
and the second check is True
.