我已經測試了下列程序,並且沒有錯誤。但是,無論何時輸入"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」,而不是與元組的平等。輸入的內容不等於它......它是它的一員。 –