In this post we will be creating a Python script that will calculate the average of a list, lists in Python are a means of storing multiple items in to a single variable. To do this we will be using the statistics module which provides functions for calculating mathematical statistics of numeric data.
See below our list for this example which contains six numbers.
List = [23, 18, 25, 26, 32, 15]
We the use the following code to calculate the average value of the the list.
import statistics List = [23, 18, 25, 26, 32, 15] print(statistics.mean(List))
The above would return the following as output.