# How to Get the Average of a List of Numbers in Python

To calculate the average (middle) of a list of numbers divide the sum of them by the length of the list. In this tutorial, we will go through how to get the average in Python.

## Python Average Example

To get the average in Python, first create a list of numbers. Then get their sum using the sum() function, divide that by the list count returned from the len() function:

``````numbers = [23, 4, 53, 9, 10]

res = sum(numbers) / len(numbers)

print(res)
``````
``````19.8
``````

## Get Average in Python Using the Statistics Package

A cleaner way to get averages in Python is by using the statistics package:

``````import statistics

numbers = [23, 4, 53, 9, 10]

statistics.mean(numbers)

print(res)
``````
``````19.8
``````

October 07, 2020

October 02, 2020

### How to Create and Use Lists (Arrays) in Python

September 01, 2020

### How to Generate Random Numbers in Python

September 20, 2020

### Find Maximum Value in a List in Python

September 22, 2021

### How to use Sets in Python

September 15, 2020