I can't understand this code. Anyone can explain please! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I can't understand this code. Anyone can explain please!

>>> False == False or True True >>> False == (False or True) False >>> (False == False) or True True

30th Nov 2017, 2:33 PM
Hasintha Lahiru
Hasintha Lahiru - avatar
2 Answers
+ 7
Firstly, '==' has a higher precedence than 'or'. Secondly 'or' returns True if atleast one of its conditions is true. Thirdly, '()' has higher precedence than '==' and 'or' 1. False == False or True => True or True => True 2. False == (False or True) => False == True => False 3. (False == False) or True => True or True => True
30th Nov 2017, 2:40 PM
Cool Codin
Cool Codin - avatar
+ 1
got it. thank you. 😌😌😌
30th Nov 2017, 2:46 PM
Hasintha Lahiru
Hasintha Lahiru - avatar