Practice · Python

Practice Precedence & Division

Apply operator precedence, use parentheses to force evaluation order, and choose true division (/) vs floor division (//) deliberately.

Precedence & Divisionwarming python…

Average Two Scores Correctly

Write a function average_score(a, b) that returns the arithmetic mean of the two integer scores a and b as a float. Use parentheses so that the addition happens before the division. For example:

  • average_score(10, 20) should return 15.0
  • average_score(5, 0) should return 2.5
Press Run to see output, or Check to grade against the tests.

Want a whole course built around precedence & division?

Start my path — free

Adaptive practice, streaks, projects with real code review. Free tier gates AI help, never content.