Operator Precedence

Now that comparisons and logical operators have joined the arithmetic ones, here is the whole ordering in one place.

The full precedence table
Now that comparisons and logical operators have joined the arithmetic ones, here is the whole ordering in one place.
PrecedenceOperatorOperation
highest**exponentiation
-negation
*, /, //, %multiplication, division, floor division, modulus
+, -addition, subtraction
==, !=, <, >, <=, >=comparisons
notlogical not
andlogical and
orlogical or
lowest=assignment
Math operators have the highest precedence. Then comparison operators are followed by logical operators. The assignment operator is evaluated last.
Although the above expression is correct, often for the sake of readability and clarity it is often good practice to include parentheses.