write a program toto take 10 numbers as input and print their average
Answers
Answered by
17
Alright, so we need to take 10 inputs.. I am not willing to write input 10 times, so, I am going to use the range() function and take the inputs and then add them to an empty and then, find the average.
For finding the average, I will be using the following functions:
(1) sum()
(2) len()
__________________________________________
CODE:
numbers = []
for i in range(10):
num = float(input('Enter the number'))
numbers.append(num)
print( f ' Average: {sum(numbers)/len(numbers)}')
___________________________________________
Similar questions