3 Answers
+ 1
I think that you referring to table precedence. Imagine this expression:
-2**4
How python resolve it? Raise to 4th power -2 or negate the result of 2 power 4? The answer is on that table and in this case interpreter raise 2 to 4 then negate the result because exponentation operator (**) has higher precendence with respect to negation operator (-). try to execute
print(-2**4)
and see
0
False == False or True
True
>>> False == (False or True)
False
>>> (False == False) or True
True
Can u please explain this example?
0
Well, comparison operators have HIGHER precendence on logical operators (like or) and grouping operator have higher precedence an all then:
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