Learn about the Program to Find Average of N Numbers in Python in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

#### Program to Find Average of N Numbers in Python

This Python program is the simplest and most straightforward way to compute the average of N numbers. Firstly, we established the total number of inputs that we intend to use. Then, using the For Loop, we will take numbers and compute the total sum of those numbers. Finally, using a formula, compute the average of those numbers and print the result.

**Source code:**

```
# Python program to find the average of n numbers
# total number count
n = int(input('How many numbers: '))
total_sum = 0
for i in range (n):
# input numbers
num = float(input('Enter number: '))
# calculate total sum of numbers
total_sum += num
# calculate average of numbers
avg = total_sum / n
# print value
print('The average value of numbers = %0.2f' %avg)
```

**Output:**

How many numbers: 2

Enter number: 5

Enter number: 10

The average value of numbers = 7.50

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

**Similar Code :** Sum of N Natural Numbers using Recursion in Python