【发布时间】:2013-09-30 04:08:32
【问题描述】:
在最后一行中,我试图将输出四舍五入到小数点后一位,但是当我测试这个时,我得到了一个意外的 EOF 错误。请帮忙?
count = 0
scoreSum = 0
score = 0
while score != 999:
score = float(input("Enter test score or enter 999 to finish: "))
if score > 0 and score < 100:
scoreSum += score
count += 1
elif (score <0 or score > 100) and score != 999:
print("This score is invalid, Enter 0-100")
else:
print ("your average is: ", round((scoreSum / count), 2)
【问题讨论】:
-
这太简单了,你在一分钟内得到了 3 个完全相同的答案 :)。向我们提出一些更好的问题!我承认 Python 的错误信息没有什么帮助。
-
哈哈,我只是个初学者,给点时间吧。