+ 2

Write a short program to find average of list of numbers enterd through keyboard.

Please...🤗

11th Sep 2018, 5:32 PM
Divita..
6 Respuestas
+ 2
# Sandeep Chatterjee you can make your code more short sum=0 for i in range(int(input("how many numbers you want to find average"))): sum+=int(input("enter element", str(i+1), ":")) print("Average is "+str(sum//n))
11th Sep 2018, 6:06 PM
Sousou
Sousou - avatar
+ 2
Please explain more
11th Sep 2018, 5:49 PM
Sousou
Sousou - avatar
+ 2
n =int(input("how many numbers you want to find average")) sum=0 while i in range (0,n): x=int(input("enter element "+str(i+1)+": ")) sum+=x avg = sum//n print("Average is"+str(avg))
11th Sep 2018, 5:49 PM
Sandeep Chatterjee
+ 2
for i in range(10) is better than while i in range(10)
11th Sep 2018, 6:12 PM
Sousou
Sousou - avatar
+ 2
Divita.. hope that will help you :)
11th Sep 2018, 7:19 PM
Sousou
Sousou - avatar
+ 1
right it is more short , nice
11th Sep 2018, 6:13 PM
Sandeep Chatterjee