-1
파이썬 2.7
한번 '플레이'를 입력 7 :
if(game == "play"):
print("Make sure you type 'Play', CaPS MaTteR! ")
startg()
elif(game == "Play"):
playg()
그것은 어떻게해야 무엇 않습니다. 'play'을 두 번 잘못 입력하면 루핑 대신 두 번 종료됩니다. 구글에를 검색하지만 아무것도 찾을 수 없습니다 :/
코드 : 코드에서
name = raw_input("What is your name? ")
gender = raw_input("What are you, a Boy or a Girl? ")
print(" ")
if(gender == "Boy"):
their = "his "
else:
their = "her "
game = raw_input("Type 'Play' to start. ")
def endg():
print("Hope you had fun! ~Red")
def startg():
game = raw_input("Type 'Play' to start. ")
if(game == "Play"):
print("Loading. . . ")
playg()
listq1 = ["A. Quit your job." , "B. Pretend you never saw the stack of papers." , "C. Kill yourself because you don't feel like playing this game. "]
def playg():
answer = raw_input("You are a programmer, " + name + ", who hates " + their + "job very much." +
" You walk into work to see a huge stack of papers on your desk... What do you do? \n" + "\n".join(listq1))
if(answer == "A"):
print("\nYou look around the room and see the flock of miserable people...Your Co-Workers. Is working here really worth the stress? ")
elif(answer == "B"):
print("\nYou pull the over-sized recycle bin out from under your desk. Just as you start to slide the papers to their impending doom, a fellow co-worker stops to ask what you are doing. ")
elif(answer == "C"):
endg()
if(game == "play"):
print("Make sure you type 'Play', CaPS MaTteR! ")
startg()
elif(game == "Play"):
playg()
나는 그것이 단순 할 것이라고 알고 있었다. 고마워! 기음: –