Use Python to find the mean of an unsorted list

Crystal X
Dec 25, 2021

In math and statistics, the mean is the average of a list of numbers. The mean is calculated as:-

The sum of observations / the number of observations

With Python it is easy to calculate the mean of a list of numbers because there are libraries that contain functions to calculate the mean. For example, Python has a library, statistics, that will automatically compute the mean.

Wouldn’t it be nice, however, to be able to calculate the mean using basic mathematical steps? It is not difficult to calculate the mean in Python, and the screenshot below provides the code to do so:-

Although there are methods that will compute the mean, it is important to know the procedure to calculate this statistic in order to gain a better under standing of mathematics and computer programming.

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet