Python Program to find the average of n numbers


In this program, You will learn how to find the average of n numbers in Python.


sum = 2 + 3 + 4 + 5

avg = sum / 4

Example: How to find the average of n numbers in Python.

n = int(input("Enter how many number:"))
s = 0
print("Enter numbers:", end="")

for i in range(0, n):
    num = int(input())
    s = s + num

avg = s / n
print("Average is:", avg)

Output:

Enter how many number:5
Enter numbers:10
20
30
40
50
Average is: 30.0