在最后一行中,我试图将输出四舍五入到小数点后一位,但是当我测试这一点时,我得到了一个意外的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)
结尾处缺少右括号:
最后一行应该是:
你错过了一个右括号。在
完整的错误消息可能是“解析时出现意外的EOF”,这确实有点神秘。专业提示:以后,如果您发现一些您不理解的错误,请始终使用past the complete error message directly into Google。在大多数情况下,其他人already asked about the same problem。在
最后一行是您的问题您需要一个右括号:
实际上,您可以将代码行设置为:
^{pr2}$不需要那些额外的括号。在
相关问题 更多 >
编程相关推荐