Operator Precedence | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Operator Precedence

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

25th Jun 2017, 2:28 AM
John Sitther
2 Answers
+ 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.
25th Jun 2017, 6:09 AM
Jonas Schröter
Jonas Schröter - avatar
+ 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
25th Jun 2017, 6:18 AM
Jonas Schröter
Jonas Schröter - avatar