How to compute the average of a list in Python

0 min

Here is the simplest method to compute the average of a list.

The arithmetic mean formula
# We set a list example
my_list = [1,2,3,4,5,6,7]

# We compute the average
average = sum(my_list) / len(my_list)

# We print out the average
print(average)
We print out the average of a list

Here you are ! You now know how to compute the average of a list.