basic python-11

Python Operator Precedence

Precedence Operator Description
1 () Parentheses
2 ** Exponentiation
3 +x, -x, ~x Unary plus, Unary minus, Bitwise NOT
4 *, /, //, % Multiplication, Division, Floor division, Modulus
5 +, – Addition, Subtraction
6 <<, >> Bitwise shift operators
7 & Bitwise AND
8 ^ Bitwise XOR
9 | Bitwise OR
10 ==, !=, >, >=, <, <=, is, is not, in, not in Comparisons, Identity, Membership operators
11 not Logical NOT
12 and Logical AND
13 or Logical OR

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top