Today we are going to share a Python program to calculate the average of numbers in a given list. If you are a python beginner and want to start learning the python programming, then keep your close attention in this tutorial as I am going to share a Python program to calculate the average of numbers in a given list.
n=int(input("Enter the number of elements to calculate average: "))
for i in range(0,n):
elem=int(input("Enter element: "))
print("Average of elements in the list",round(avg,2))
Enter the number of elements to calculate average: 5
Enter element: 5
Enter element: 10
Enter element: 15
Enter element: 20
Enter element: 25
Average of elements in the list 15
To increase your Python knowledge, practice all Python programs, here is a collection of 100+ Python problems with solutions.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.