2017-03-02 40 views
0
elif direction == "kitchen".lower(): 
    print"" 
    print("• As you enter the kitchen you get blasted with heat. "+kitchen)    
    print"" 
    print("• "+lobby) 
    print"" 
    direction=raw_input("• Where would you like to go next? ") 
    if direction == "kitchen".lower(): 
     print"" 
     print("• As you enter the kitchen again the stove explodes and you die    in the fire.") 
     print"" 
     print("• Game over.") 
    else: 
     print"" 
elif direction == "closet".lower(): 
    print"" 
    print("• As you step closer to the closet you can tell the door was  smashed down by something.") 
    print"" 

是否可以改變從「廚房」到「壁櫥」的方向還是我需要兩個變量?這是爲了嘗試進入新房間的文本冒險遊戲。是否有可能讓用戶爲一個變量輸入兩個新答案,並在每次詢問時都改變它?

+1

我懷疑你打算寫'direction.lower()'。字符串'「廚房」'已經是小寫字母。 – tripleee

+0

切向另請參見http://stackoverflow.com/questions/18557616/how-to-use-commands-again-without-copy-and-pasting-them – tripleee

回答

0

是的,你在做什麼是正確的。您可以隨時爲變量分配一個新值。

相關問題