Operator Precedence | SoloLearn: Learn to code for FREE!

0

Operator Precedence

>>> False == False or True True >>> False == (False or True) False >>> (False == False) or True True Please explain this more simply.

6/25/2017 2:28:54 AM

John Sitther

2 Answers

New Answer

+1

The equality operator "==" has a higher precedence as the "or" operator, so first the statement with "==" is solved, after that the "or" is solved. Parentheses have higher precedence as "or" and "==", so the statement inside them is solved first.

+1

First False == False --> True, True or True --> True Second False or True --> True, True == False --> False Third False == False --> True, True or True --> True