lesson

Average of three

objective: debugging exercise · arithmetic & precedence · medium
Task type: fix broken code

average(a, b, c) should return the average of all three numbers. Right now the result is way off.

fix this code so it matches

average(3, 6, 9) is 6.0. average(6, 6, 6) is 6.0. average(0, 3, 9) is 4.0. average(-3, 0, 3) is 0.0.

  • Passes the visible tests
  • Passes the hidden tests (edge cases)
Go deeper

Lesson resources

Finding resources…
average.pyattempt 0
1
2
3