---
description: Python Average - Two ways to find average of a list in Python. By using sum() and len() built-in functions from python or using Python mean() function.
title: How to Find Average of List in Python
image: https://www.guru99.com/images/find-average-of-a-list-in-python.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Finding the average of a list in Python means dividing the sum of its numbers by their count. Here you will learn four ways to do it: a loop, sum() with len(), the statistics module, and NumPy.

* ➗ **The formula:** Average is the sum of the numbers divided by how many there are.
* ⚡ **sum() / len():** sum(list)/len(list) finds the average in one line.
* 📊 **mean():** statistics.mean() and numpy.mean() return the average directly.
* 🤖 **AI help:** AI tools like Copilot generate average code instantly.

[ Read More ](javascript:void%280%29;) 

![Find Average of a List in Python](https://www.guru99.com/images/find-average-of-a-list-in-python.png)

## Python Average

The **Python Average** function is used to find the average of given numbers in a list. The formula to calculate average in Python is done by calculating the sum of the numbers in the list divided by the count of numbers in the list.

The Python average of list can be done in many ways listed below:

## Method 1: Python Average via Loop

In this example, we have initialized the variable sum\_num to zero and used for loop. The [for-loop](https://www.guru99.com/python-loops-while-for-break-continue-enumerate.html) will loop through the elements present in the list, and each number is added and saved inside the sum\_num variable. The average of list Python is calculated by using the `sum_num` divided by the count of the numbers in the list using `len()` built-in function.

### Code Example

def cal_average(num):
    sum_num = 0
    for t in num:
        sum_num = sum_num + t           
    avg = sum_num / len(num)
    return avg
print("The average is", cal_average([18,25,3,41,5]))

**Output:**

The average is 18.4

## Method 2: Python Average – Using sum() and len() built-in functions

In this example the `sum()` and `len()` built-in functions are used to find average in Python. It is a straight forward way to calculate the average as you don’t have to loop through the elements, and also, the code size is reduced. The average can be calculated with just one line of code as shown below.

### Program Example

# Example to find average of list
number_list = [45, 34, 10, 36, 12, 6, 80]
avg = sum(number_list)/len(number_list)
print("The average is ", round(avg,2))

**Output:**

The average is  31.86

### RELATED ARTICLES

* [How to Create (Write) Text File in Python ](https://www.guru99.com/reading-and-writing-files-in-python.html "How to Create (Write) Text File in Python")
* [Python Timeit() with Examples ](https://www.guru99.com/timeit-python-examples.html "Python Timeit() with Examples")
* [Python String count() with EXAMPLES ](https://www.guru99.com/python-string-count.html "Python String count() with EXAMPLES")
* [Flask vs Django – Difference Between Them ](https://www.guru99.com/flask-vs-django.html "Flask vs Django – Difference Between Them")

## Method 3: Python Average Using mean function from statistics module

You can easily calculate the “average” using the mean function from the statistics module. Example shown below

# Example to find the average of the list
from statistics import mean
 
number_list = [45, 34, 10, 36, 12, 6, 80]
avg = mean(number_list)
print("The average is ", round(avg,2))

**Output:**

The average is  31.86

## Method 4: Average in Python Using mean() from numpy library

[Numpy](https://www.guru99.com/numpy-tutorial.html) library is commonly used library to work on large multi-dimensional arrays. It also has a large collection of mathematical functions to be used on arrays to perform various tasks. One important one is the `mean()` function that will give us the average for the list given.  

### Code Example

# Example to find avearge of list
from numpy import mean
number_list = [45, 34, 10, 36, 12, 6, 80]
avg = mean(number_list)
print("The average is ", round(avg,2))

**Output:**

C:\pythontest>python testavg.py
The average is  31.86

## FAQs

➗ How do you find the average of a list in Python?

Divide the sum by the length: sum(number\_list)/len(number\_list). You can also use statistics.mean() or numpy.mean().

🔁 How do you average a list using a loop?

Add each element to a running total in a for-loop, then divide the total by len(list).

⚡ How do you average a list with sum() and len()?

Use sum(number\_list)/len(number\_list). sum() adds all values and len() counts them, giving the average in one line.

📊 How do you find the average using the statistics module?

Import mean from the statistics module and call mean(number\_list). It is part of Python’s standard library.

🧮 How do you average a list with NumPy?

Import mean from numpy and call mean(number\_list). NumPy is fast for large numerical arrays.

🤖 How can AI tools like GitHub Copilot help calculate averages?

AI assistants like GitHub Copilot autocomplete average code and suggest sum(), mean(), or NumPy as you type.

🧠 Can AI automate statistics code in Python?

Yes. AI-powered tools write functions for averages and other statistics and recommend the fastest approach for large data.

❓ Why round the average in Python?

Averages often have long decimals. Use round(avg, 2) to keep two decimal places for readable output.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/find-average-of-a-list-in-python.png","url":"https://www.guru99.com/images/find-average-of-a-list-in-python.png","width":"700","height":"250","caption":"Find Average of a List in Python","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/find-average-list-python.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/python","name":"Python"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/find-average-list-python.html","name":"How to Find Average of List in Python"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/find-average-list-python.html#webpage","url":"https://www.guru99.com/find-average-list-python.html","name":"How to Find Average of List in Python","dateModified":"2026-07-11T10:40:36+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/find-average-of-a-list-in-python.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/find-average-list-python.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/anna","name":"Anna Blake","description":"I'm Anna Blake, specializing in Python tutorials, offering clear and concise lessons to help you master Python programming efficiently.","url":"https://www.guru99.com/author/anna","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/anna-blake-author.png","url":"https://www.guru99.com/images/anna-blake-author.png","caption":"Anna Blake","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Python","headline":"How to Find Average of List in Python","description":"Python Average - Two ways to find average of a list in Python. By using sum() and len() built-in functions from python or using Python mean() function.","keywords":"python","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/anna","name":"Anna Blake"},"dateModified":"2026-07-11T10:40:36+05:30","image":{"@id":"https://www.guru99.com/images/find-average-of-a-list-in-python.png"},"copyrightYear":"2026","name":"How to Find Average of List in Python","subjectOf":[{"@type":"HowTo","name":"How to Find Average of a List in Python","description":"The Python average of list can be done in many ways listed below","step":[{"@type":"HowToStep","name":"Method 1) Python Average via Loop","text":"In this example, we have initialized the variable sum_num to zero and used for loop.","url":"https://www.guru99.com/find-average-list-python.html#step1"},{"@type":"HowToStep","name":"Method 2) Python Average - Using sum() and len() built-in functions","text":"In this example the sum() and len() built-in functions are used to find average in Python.","url":"https://www.guru99.com/find-average-list-python.html#step2"},{"@type":"HowToStep","name":"Method 3) Using mean function from statistics module","text":"You can easily calculate the 'average' using the mean function from the statistics module.","url":"https://www.guru99.com/find-average-list-python.html#step3"},{"@type":"HowToStep","name":"Method 4) Using mean() from numpy library","text":"Numpy library is commonly used library to work on large multi-dimensional arrays.","url":"https://www.guru99.com/find-average-list-python.html#step4"}]},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"How do you find the average of a list in Python?","acceptedAnswer":{"@type":"Answer","text":"Divide the sum by the length: sum(number_list)/len(number_list). You can also use statistics.mean() or numpy.mean()."}},{"@type":"Question","name":"How do you average a list using a loop?","acceptedAnswer":{"@type":"Answer","text":"Add each element to a running total in a for-loop, then divide the total by len(list)."}},{"@type":"Question","name":"How do you average a list with sum() and len()?","acceptedAnswer":{"@type":"Answer","text":"Use sum(number_list)/len(number_list). sum() adds all values and len() counts them, giving the average in one line."}},{"@type":"Question","name":"How do you find the average using the statistics module?","acceptedAnswer":{"@type":"Answer","text":"Import mean from the statistics module and call mean(number_list). It is part of Python's standard library."}},{"@type":"Question","name":"How do you average a list with NumPy?","acceptedAnswer":{"@type":"Answer","text":"Import mean from numpy and call mean(number_list). NumPy is fast for large numerical arrays."}},{"@type":"Question","name":"How can AI tools like GitHub Copilot help calculate averages?","acceptedAnswer":{"@type":"Answer","text":"AI assistants like GitHub Copilot autocomplete average code and suggest sum(), mean(), or NumPy as you type."}},{"@type":"Question","name":"Can AI automate statistics code in Python?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI-powered tools write functions for averages and other statistics and recommend the fastest approach for large data."}},{"@type":"Question","name":"Why round the average in Python?","acceptedAnswer":{"@type":"Answer","text":"Averages often have long decimals. Use round(avg, 2) to keep two decimal places for readable output."}}]}],"@id":"https://www.guru99.com/find-average-list-python.html#schema-207394","isPartOf":{"@id":"https://www.guru99.com/find-average-list-python.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/find-average-list-python.html#webpage"}}]}
```
