+ 1

How is this expression False == (False or True), False?

Operator Precedence in Python

2nd May 2019, 6:59 PM
Oluwatosin
Oluwatosin - avatar
4 Antworten
+ 3
False or True is True then False == True is False
2nd May 2019, 7:05 PM
Sergiu Panaite
Sergiu Panaite - avatar
+ 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.
2nd May 2019, 7:15 PM
Oluwatosin
Oluwatosin - avatar
0
Aymane Boukrouh you said False == False, should be False == True or have I read your comment wrong?
2nd May 2019, 7:09 PM
Sergiu Panaite
Sergiu Panaite - avatar
0
Sorry Aymane Boukrouh , you’re right. Was not intentional though.
2nd May 2019, 7:14 PM
Sergiu Panaite
Sergiu Panaite - avatar