In python interpreter,
min(True,False)==False
max(True,False)==True
is assured by design?
True is equal to 1 and False is 0
It seems, at least in CPython, bool subclasses int. Therefore, you can do:
>>> abs(False)
0
>>> abs(True)
1
and:
>>> False < True
True
>>> True > False
True
I guess max and min work on the comparison operator:
>>> cmp(False, True)
-1
>>> cmp(True, False)
1
>>> cmp(False, False)
0
>>> cmp(True, True)
0
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