Ranking Python arithmetic precedence levels

Python evaluates a mixed arithmetic expression according to a fixed precedence ranking. Arrange these levels from highest priority (evaluated first) to lowest priority (evaluated last).

  1. 1.

    Unary minus, as in -x

  2. 2.

    Exponentiation **

  3. 3.

    Addition and subtraction + and -

  4. 4.

    Multiplicative operators *, /, // and %

  5. 5.

    Parentheses ( )

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Arithmetic Operators and Expressions Questions: