How can I compute a sum from the grades_input?


#1

Question

How can I compute a sum from the grades_input?

Answer

Rather than computing a sum with another loop, we can make use of the function we made in the previous step: grades_sum(). If we create some variable to hold the sum of the input list, grades_input, we can assign it a value by doing our_variable = grades_sum(grades_input).
After that, computing the average can be done by following the instructions and ensuring that you make the average a float!


FAQ: Learn Python - Exam Statistics - Computing the Average