aArtsitNames = ["Artist Name: \"TwnetyOnePiloits\" "],["Artist Name: \"Bastile\" "]
aSongNamesBlanks = ["R___" ],["B__ N____"]
aSongNames = ["Ride"],["Bad News"]
print( aArtsitNames [0] )
print( aSongNamesBlanks [0] )
nUserAnswer = input("Enter the song name: ")
if nUserAnswer == aSongNames[0]:
print ("correct")
它具有更多组件,但我将其简化了以使其正常运行。 谁能帮我解决为什么不起作用?
答案 0 :(得分:1)
您没有正确创建列表。您实际上是在创建列表列表。要创建字符串列表,正确的语法应为:
aArtsitNames = ["Artist Name: \"TwnetyOnePiloits\" ", "Artist Name: \"Bastile\" "]
aSongNamesBlanks = ["R___" , "B__ N____"]
aSongNames = ["Ride", "Bad News"]
print( aArtsitNames [0] )
print( aSongNamesBlanks [0] )
nUserAnswer = input("Enter the song name: ")
if nUserAnswer == aSongNames[0]:
print ("correct")
答案 1 :(得分:0)
您没有创建列表。 尝试
"multiline": "never"