Table of Precedence and Associativity

This table shows the precedence and associativity of the arithmetic, relational, and logical operators from highest to lowest precedence.

OperationDescriptionAssociativity
()parentheses for groupingleft to right
**exponentiationright to left
+, - unary + (positive sign), unary − (negative sign)left to right
*, /, //, %multiplication, division, remainderleft to right
+, -addition and subtractionleft to right
in, not in, is, is not,
<, <=, >, >=, !=, ==
membership and comparisonsleft to right
notboolean notleft to right
andboolean andleft to right
orboolean orleft to right


You can also obtain a PDF version of this. Version of January 8, 2019 at 8:56PM