I just need to figure out how to find the average of all these input numbers by the user while using 0 as a exit of the loop.
I need to figure out how to eliminate using 0 as part of the average. example: 5, 0, 5 ,5... the average is 5 by eliminating the 0.
nA = 1
nSum = 0
print ('enter numbers to find the average')
print ('enter 0 to quit.')
while nA !=0:
nA = input ('gemmi a number:')
nSum+=nA
dAvg = nSum
print 'the total amount of numbers is' , nSum ,
print 'your average is' , dAvg ,
How do I do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…