我正在创建一个程序,该程序接受输入分数,将它们添加到列表中,并使用 for 循环将它们全部添加到一起显示总数。虽然遇到一些问题。请检查一下..
scoreList = []
count = 0
score = 0
sum = 0
while score != 999:
score = float(input("enter a score or enter 999 to finish: "))
if score > 0 and score < 100:
scoreList.append(score)
elif (score <0 or score > 100) and score != 999:
print("This score is invalid, Enter 0-100")
else:
for number in scoreList:
sum = sum + scoreList
print (sum)