elif语句的语法错误无效

时间:2014-11-27 18:22:12

标签: python

elif choice == "2":
    name = input("What is your name? ")
    score = int(input("What score did you get? ")
    entry = (score, name)
    scores.append(entry)
    scores.sort(reverse=True)
    scores = scores[:10]

为什么entry = (score, name)出现在Invalid syntax error

2 个答案:

答案 0 :(得分:2)

你错过了关闭paren:

int(input("What score did you get? ")) #  <-  missing a closing paren  

答案 1 :(得分:2)

您忘记了)末尾的score = int(input("What score did you get? ")。它应该是score = int(input("What score did you get? "))