我总是收到一个不好的输入,但我不知道如何解决它。
如果格式不正确,很抱歉。
这是Python2.6上的

videoGames = ["Fortnite", "Minecraft", "Roblox", "2048", "Mario Cart"]
favGame = raw_input("What is your favorite video game?")
if favGame == videoGames[1]
    print("Hi.")
print("Really?! We both enjoy playing") #add the input that matches with the list

如果用户输入与列表中的某个项匹配,那么它将打印“真的吗?!我们都喜欢玩(游戏)

最佳答案

此行缺少冒号:

if favGame == videoGames[1]

应该是
if favGame == videoGames[1]:

要打印游戏:
if favGame in videoGames:
    print("Really?! We both enjoy playing", favGame)

09-20 10:37