Ranking expressions by operator precedence

Each item below is a complete Python expression typed at the interpreter. Evaluate each one using Python's operator precedence and associativity rules, then arrange the expressions from the smallest resulting value to the largest.

  1. 1.

    2**3**2

  2. 2.

    2 * 3**2

  3. 3.

    -2**2

  4. 4.

    (2 * 3)**2

  5. 5.

    (-2)**2

  6. 6.

    2**-1

  7. 7.

    10 % 4

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 Python Programming Questions: