该问题是指以下python程序-
# High Scores
# Maintains a list of the five highest scores and the players responsible.
hiscores = [56,45,23,11]
again = "a"
def findplace(xlist, x):
# list is in descending order
for j in range(len(xlist)-1):
if x >= xlist[j]:
xlist.insert(j, x)
return xlist
while again:
print("\n", hiscores)
score = int(input("\nEnter a score (zero to exit): "))
if score >= hiscores[3]:
hiscores = findplace(hiscores, score)
elif score == 0:
again = ""
print(hiscores)
input("\nETE")
该程序从用户那里获取分数,如果它们足够高,则将它们添加到列表中。我想通过将 while 循环第三行的索引值设置为 3 来将入门级别设置为最低分数,但这会引发错误。0、1 和 2 完美运行!我究竟做错了什么?