15,944,136 members
1.00/5 (1 vote)
See more:
Input format

First line contains the number of numbers, n

Next ‘n’ lines contain the numbers in the collection

Output format:

Print Average in two decimal format

What I have tried:

Python
```n=input()
for i in range(0,n):
ni=input()
print(ni)
for i in range(0,n):```

i am not really able to understand how to take unknown no. of inputs and then their average
Posted
Updated 10-Nov-20 4:34am
v2

## Solution 1

You may store the entered numbers into a list (and then perform the computations) or, alternatively, you may compute their sum 'on the fly' and then compute the average.
In the following code, I show you how to store the numbers into a list
Python
```n = int(input())
l = []
for i in range(0,n):
l.append(float(input()))

print(l)```

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Pete O'Hanlon 60 aisha.offical 24 OriginalGriff 10 Stephen Hewison 5 Iman Shabanzade -6
 Pete O'Hanlon 965 OriginalGriff 810 Richard Deeming 715 merano99 345 Dave Kreskowiak 310

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900