What is correct operators precedence in Python?

PythonServer Side ProgrammingProgramming

Following table shows order of precedence of operators in Python starting from highest to lowest precedence.

** : Exponentiation (raise to the power)
~ + - : Ccomplement, unary plus and minus (method names for the last two are +@ and -@)
* / % // : Multiply, divide, modulo and floor division
+ - : Addition and subtraction
>> << : Right and left bitwise shift
& : Bitwise 'AND'

^ | : Bitwise exclusive `OR' and regular `OR'

<= < > >= : Comparison operators

<> == != : Equality operators

= %= /= //= -= += *= **= : Assignment operators

is is not : Identity operators

in not in : Membership operators

not or and : Logical operators

raja
Published on 10-Feb-2018 08:34:19
Advertisements