Which of the following is the correct precedence of operators in Python?
2023
Which of the following is the correct precedence of operators in Python?
- A.
Braces, or, and, not
- B.
not, Braces, and, or
- C.
not, Braces, or, and
- D.
Braces, not, and, or
Attempted by 1967 students.
Show answer & explanation
Correct answer: D
Key point: Operator precedence from highest to lowest: parentheses (braces) → not → and → or. parentheses (braces): group expressions and are evaluated first.
not: unary logical negation, evaluated after parentheses.
and: logical conjunction, evaluated after 'not'.
or: logical disjunction, lowest precedence among these operators.
Example: Evaluate the expression step by step: Start: not False and False or True
Step 1 (not): not False