2017-03-02 1 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"" 

"kitchen"에서 "closet"으로 방향을 바꿀 수 있습니까? 아니면 두 개의 변수가 필요합니까? 이것은 새로운 방에 들어가려고하는 텍스트 어드벤처 게임을위한 것입니다.사용자가 한 변수에 대해 두 개의 새로운 대답을 입력하게하고 질문 할 때마다 변경되도록 할 수 있습니까?

+1

나는'direction.lower()'를 쓰려고했다. 문자열''kitchen ''은 이미 소문자입니다. – tripleee

+0

접미어를 참조하십시오 http://stackoverflow.com/questions/18557616/how-to-use-commands-again-without-copy-and-paste-them – tripleee

답변

0

예, 뭐하고 있니? 맞습니다. 언제든지 변수에 새 값을 지정할 수 있습니다.

관련 문제