Python Practice › List Programs › Program 66

Average of a list

EasyList Programs · 66 of 100

Write a Python program to calculate the average of a list.

Advertisement
Input
[3, 5, 7, 2, 6, 12, 3]
Output
5.428571428571429 5.43

Approach

  1. sum / len.

Solution

Python
numbers = [3, 5, 7, 2, 6, 12, 3]avg = sum(numbers) / len(numbers)print(avg, round(avg, 2))
Output
5.428571428571429 5.43

Learn the concept

New to this topic? Read the lesson, then come back.

More list programs

← All 100 List Programs

Leave a Comment