Learn
Exam Statistics
Computing the Average

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.

Instructions

1.

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.

Folder Icon

Take this course for free

Already have an account?