+ 1
Why is (17 == True) =False but (if 17: print("yes")) print yes?
4 Respuestas
+ 5
You are comparing 17 to true that is equivalent to 17 == 1 and of course results false.
in the second if statement there is no comparision so the statement results true.
+ 1
That is because, internally, True = 1
+ 1
https://docs.python.org/3/library/stdtypes.html#truth-value-testing
0
Because int(True) is 1 and bool(17) is True