+ 2

Can anyone explain the how the output of print(false==(false or true)) is false??

11th Nov 2016, 9:56 AM
PAWAN KUMAR
PAWAN KUMAR - avatar
3 Answers
+ 7
false==(false or true) Consider the inner statement "(false or true)". this will evaluate to "true" because " 1 or 0" is 1, i.e., true. Now, false==(false or true) translates to (false==true) and that is false since false cant be true. So answer is false.
11th Nov 2016, 10:17 AM
P Sandesh Baliga
P Sandesh Baliga - avatar
+ 1
operator-precedence first, (false or true) it's true second, false==true obviously,it's false so,answer is false!
13th Nov 2016, 9:53 AM
ling gan
ling gan - avatar
0
code: (False == (False or True)) translation: Is False equal to (False or True)? #False or True is always True because 'or' operator needs only one of the values to be True #unlike 'and' operator who needs all values to be True (False and True == True) Is False equal to True? --> False
12th Nov 2016, 9:53 PM
Davor