# Python program to find average of N numbers

Written by

## Python Average program

In this python program we will learn to calculate the average of number for N numbers.

**Average is the sum of items divided by the number of items.**

Here, we’ll calculate the sum and average of a natural number as listed by the user.

**Algorithm:**

- Declare variables
`n`

(for the number of elements in the list) and`sum`

(for the sum of the elements). Initialize`sum`

to 0. - Prompt the user to enter the value of
`n`

. - Use a
`for`

loop to iterate over the elements of the array and calculate the sum of the elements. - Calculate the average of the elements by dividing the sum by the number of elements.

**Code:**

```
n = int(input("Enter the total number you want to enter:"))
sum = 0
for i in range(n):
x = int(input("Enter the number:"))
sum = sum + x
avg = sum / n
print("Average=", avg)
```

**Output:**

```
Enter the total number you want to enter:4
Enter the number:2
Enter the number:4
Enter the number:6
Enter the number:8
Average= 5.0
```