Precedence of operators in Python 3
Precedence specifies the priority of operators in an expression.
It specifies the order in which operators will be evaluated left to right in an expression. Operators precedence table in Python :
S. No | Operators |
1 | ** |
2 | ~ ,+, – (Unary operators) |
3 | *, /, % , // |
4 | +, – |
5 | >> ,<< |
6 | & |
7 | ^, | |
8 | <=, <, >, >= |
9 | ==, != |
10 | =, %=, /=, //=, -=, +=, *=, **= |
11 | is, is not |
12 | in, not in |
13 | Not, or, and |