The average test grade can be found by dividing the sum of the grades by the total number of grades.

Luckily, we just created an awesome function, grades_sum to compute the sum.



Define a function, grades_average, below the grades_sum function that does the following:

  • Has one argument, grades_input, a list
  • Calls grades_sum with grades_input
  • Computes the average of the grades by dividing that sum by float(len(grades_input)).
  • Returns the average.

Call the newly created grades_average function with the list of grades and print the result.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?