Python is a highly readable, less syntactic, interactive, object-oriented, interpreted, and high-level programming language. Python uses English terms instead of punctuation.

Some of the features of Python are mentioned below -

• It can be used for production-ready applications or rapid prototyping as well.
• It can handle complex computations and big data.
• It uses simpler syntax and can be used to write complex codes in a shorter and simpler way.
• Designed for readability and provides scope. It mainly relies on whitespace, indentation, etc.

In this article, we will discuss how to find the average of numbers present in the list in Python using the Average function in Python.

#### Python Training Course

Learn Data Operations in Python ## Python Average

To find the average of given numbers in a list, we use the Python Average function. Average in Python is usually calculated by adding all the numbers in a list and then dividing it by the number of elements in this list.

There are multiple ways to find the average of a List in Python, and two of the main ways are mentioned below:

1) Python Average: Len() and Sum()

2) Python Average: statistics.mean()

### 1) Python Average: Len() and Sum()

The Sum() and Len() functions are built-in in Python and are used to find the averages.

This method of finding the average helps avoid looping through the list and hence is time and effort-saving. This also reduces redundancy and helps maintain DRY code since it helps in finding the average of a list using a single line.

#### Example 1

numbers = [30, 55, 3, 10, 2]

average = sum(numbers)/len(numbers)

print("Average of list: ", round(average,3))

#### Output

Average of the list:  20.0

#### Example 2

num_list = [1, 999, 2, 1023, 223, 876, 32]

average = sum(num_list)/len(num_list)

print("Average of list: ", round(average,2))

#### Output

Average of the list:  450.86

#### Example 3

numbers = [3098, 5565, 323, 1120, 2342, 75664]

average = sum(numbers)/len(numbers)

print("Average of list: ", round(average,1))

#### Output

Average of the list:  14685.3

#### Example 4

numbers = [3, 55986365, 564323, 1314320, 72325342, 7534265664]

average = sum(numbers)/len(numbers)

print("Average of list: ", round(average,4))

#### Output

Average of the list:  1277409336.1667

#### Free Course: Python for Beginners

Master the fundamentals of Python ### 2) Python Average: statistics.mean()

To easily calculate the python average of a list, we can use the statistics module’s mean() function. The following examples demonstrate the same.

#### Example 1

from statistics import mean

num_list = [30, 55, 3, 10, 2]

average = mean(num_list)

print("Average: ", round(average,3))

Average:  20

#### Example 2

from statistics import mean

numbers = [1, 999, 2, 1023, 223, 876, 32]

average = mean(numbers)

print("Average: ", round(average,3))

#### Output

Average:  450.857

#### Example 3

from statistics import mean

num_list = [3098, 5565, 323, 1120, 2342, 75664]

average = mean(num_list)

print("Average of list: ", round(average,1))

#### Output

Average of the list:  14685.3

#### Example 4

from statistics import mean

num_list = [3, 55986365, 564323, 1314320, 72325342, 7534265664]

average = mean(num_list)

print("Average of list: ", round(average,4))

#### Output

Average of the list: 1277409336.1667

Looking forward to make a move to programming? Take up the Python Training Course and begin your career as a professional Python programmer.

## Master Python With Simplilearn!

To find the average of the numbers in a list in Python, we have multiple ways. The two main ways are using the Len() and Sum() in-built function and using the mean() function from the statistics module. In order to grasp Python concepts and dive deep into python development, we must consider resources that give us a complete insight into the topics with examples, activities, and exercises.

Simplilearn provides such a comprehensive course through its Python Development Training program; you can check it out to get started with your Python journey! Ravikiran A S