+ 2
Write a short program to find average of list of numbers enterd through keyboard.
Please...🤗
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))
+ 2
Please explain more
+ 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))
+ 2
for i in range(10) is better than while i in range(10)
+ 2
Divita.. hope that will help you :)
+ 1
right it is more short , nice