count = 0
total = 0
while True:
inp = raw_input ('enter a number:')
if inp == 'done' : break
if len(inp) < 1 : break
num = float(inp)
count = count + 1
total = total + num
print num, total, count
print "average:", total/count
我的打印輸出沒有顯示出平均值,我錯過了什麼嗎?沒有得到的平均值
我正在使用python。 –
它顯示我運行它時的平均值 –
你會得到什麼?嘗試使用數字1-5 – Jacobr365