Boolean precedence
Three operators. One clear order.
Meet the order
1Flip
2Both
3Either
not binds most tightly. and comes next. or comes last.
See the grouping
False or True and not False
Truenot False becomes TrueTry another expression
These steps show how the expression groups. Python can skip a branch when it runs.
Parentheses change the grouping.
Same values. Different result.
Grouping is only half the story.
Python reads operands from left to right. If or finds True, it skips the right side. If and finds False, it does the same.
or(not False)
Right side skipped. The result is already True.
Change the left value to see what Python evaluates.
Which operator groups first?
1 of 6Select an operator in the expression.
You’ve got the order.
notandorParentheses set the grouping.
Short-circuiting decides what runs.
Review the lesson