Checkpoint 5.32.1.
Write a function called
average_of_num_list
that takes in a parameter num_list
and returns the average of all the numbers in num_list. For example, average_of_num_list([0, 20.8, 80, 5])
would return 26.45
.
Solution.
Write a function called average_of_num_list that takes in a parameter num_list and returns the average of all the numbers in num_list. For example, average_of_num_list([0, 20.8, 80, 5]) would return 26.45.
def average_of_num_list(num_list):
return sum(num_list) / len(num_list)