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.

#### Want a Top Software Development Job? Start Here!

Full Stack Developer - MERN Stack

## 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

#### Master Web Scraping, Django & More!

Python Certification Course

### 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

## Choose The Right Software Development Program

This table compares various courses offered by Simplilearn, based on several key features and details. The table provides an overview of the courses' duration, skills you will learn, additional benefits, among other important factors, to help learners make an informed decision about which course best suits their needs.

 Program Name Automation Testing Masters Program Full Stack Developer - MEAN Stack Caltech Coding Bootcamp Geo All All US University Simplilearn Simplilearn Caltech Course Duration 11 Months 11 Months 6 Months Coding Experience Required Basic Knowledge Basic Knowledge Basic Knowledge Skills You Will Learn Java, AWS, API Testing, TDD, etc. HTML, CSS, Express.js, API Testing, etc. Java, JavaScript, Angular, MongoDB, etc. Additional Benefits Structured GuidanceLearn From ExpertsHands-on Training Blended Learning ProgramLearn 20+ Tools and SkillsIndustry Aligned Projects Caltech Campus ConnectCareer Services17 CEU Credits Cost \$\$ \$\$ \$\$\$\$ Explore Program Explore Program Explore Program

## 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 Training. This course can help you hone the right skills and become job-ready in no time.

If you have any questions, feel free to post them in the comments section below. Our team will get back to you at the earliest.

## Our Software Development Courses Duration And Fees

Software Development Course typically range from a few weeks to several months, with fees varying based on program and institution.

Program NameDurationFees
Caltech Coding Bootcamp

Cohort Starts: 7 Oct, 2024

6 Months\$ 8,000
Full Stack Java Developer Masters Program

Cohort Starts: 2 Oct, 2024

7 months\$ 1,449
Automation Test Engineer Masters Program

Cohort Starts: 7 Oct, 2024

8 months\$ 1,499
Full Stack (MERN Stack) Developer Masters Program

Cohort Starts: 7 Oct, 2024

6 Months\$ 1,449