This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
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.
The post How to Calculate Mean of List in Python appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Ariessa Norramli

Ariessa Norramli | Sciencx (2021-02-23T10:35:24+00:00) How to Calculate Mean of List in Python. Retrieved from https://www.scien.cx/2021/02/23/how-to-calculate-mean-of-list-in-python/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.