+ 1
How is this expression False == (False or True), False?
Operator Precedence in Python
4 Antworten
+ 3
False or True is True
then False == True is False
+ 2
False = 0
True = 1
or : 1 + 0 = 1, 0 + 0 = 0, 1 + 1 = 1
and: 1 * 0 = 0, 0 * 0 = 0, 1 + 1 = 1
So that False ==(False or True)
0 == (0 + 1)
0 == (1)
Answer is 0 which is False.
Thanks. I get it better now.
0
Aymane Boukrouh you said False == False, should be False == True or have I read your comment wrong?
0
Sorry Aymane Boukrouh , you’re right. Was not intentional though.