Operator Precedence | SoloLearn: Learn to code for FREE!

+1

Operator Precedence

I don't understand this concept: >>> False == False or True True >>> False == (False or True) False >>> (False == False) or True True

5/5/2020 7:51:49 AM

Syakirin Ooi

2 Answers

New Answer

+2

Everything that is in parenthesis"()" is operated first as it have highest precedence. Rest is performed from left to right. 1) False == False or True True or True (as False == False is true) >>>>True 2) False == (False or True) False == (True) >>>>False 3) (False == False) or True True or True >>>>True

+2

What you didn't understand? In 1st == has higher precedence ,so that's why it evaluates to True ,in rest bracket ones are evaluated first