operator precedence python3 code example

Example: operator precedence in python

Operator Precedence from highest to lowest

Parentheses/Brackets {} [] () 
function calling e.g square(5), indexing/slicing
await x
Exponentiation e.g x ** 3
+x, -x postive/negative
multiplication, division remainders e.g *, //, /, %
Addition and Subtraction, + and -
Shifts: <<, >>
Bitwise AND: &
Bitwise XOR: ^
Bitwise OR: |
Comparisons: in, is, is not, not in, ==, !=, >, <, >=, <=
Boolean NOT: not x
Boolean AND: and
Boolean OR: or
Conditional: if, else, elif
lambda expressions
Assignment Operator: =