我已经测试了下列程序,并且没有错误。但是,无论何时输入"hangman"
,它都不会启动名为"if response_2"
的if
语句代码块。为什么它没有运行它?Python 2.7:如果代码块不工作
response_2 = raw_input("What would you like to play? Hangman or Word Guess?")
if response_2 == ("Hangman", "hangman"):
print "Running Hangman..."
print "Catching Criminals..."
print "Building Gallows..."
print "Getting that one song boy from Pirate's of the Carribean"
elif response_2 == ("Word_Guess", "word_guess", "word guess", "Word Guess", "Word guess", "word Guess", "Word_guess", "word_Guess"):
print "Not completed yet"
请将代码粘贴到问题中。随着时间的推移,链接变得糟糕,那么这会离开SO? –
你的情况可以**不会**为“真”。为什么这个街区会跑? – jonrsharpe
它需要是一个“in”,而不是与元组的平等。输入的内容不等于它......它是它的一员。 –