我总是就行了错误的输入,但我不知道如何解决它。对不起,如果它的格式不正确。
这是关于Python 2.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)