-1
的Python 2.7
Windows 7的爲什麼不循環?
當我鍵入 '發揮' 一次:
if(game == "play"):
print("Make sure you type 'Play', CaPS MaTteR! ")
startg()
elif(game == "Play"):
playg()
它做什麼是應該做的。當我輸入'玩'錯誤兩次,而不是循環它只是退出。搜索它在谷歌,但找不到任何東西:/
代碼:
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()
我知道這會很簡單,謝謝! C: – 2014-10-02 03:28:41