In this article, you will learn how to calculate the mean of a list in Python.

Let’s say you have a list named ‘a’ with value [1, 2, 3, 4, 5].

a = [1, 2, 3, 4, 5]

In order to calculate the mean of a list, you can use the statistics.mean() method.

## Import statistics module
import statistics

a = [1, 2, 3, 4, 5]

print(statistics.mean(a))
## => 3

Note: The statistics.mean() method functions by returning the mean of a supplied list. In statistics, mean refers to the average of a set of values.

#python

How to Calculate Mean of List in Python
2.40 GEEK