笨办法学Python 3 ex35学习笔记
from sys import exit
def gold_room():
#print("This room is full of gold. How much do you take?")
print("这个房间装满了金子。你要多少钱?")
choice = input(">")
if "0" in choice or "1" in choice:
how_much = int(choice)
else:
#dead("Man, learn to type a number.")
dead("伙计,学着打个数字")
if how_much < 50:
#print("Nice , you're not greedy , you win!")
print("很好,你不贪婪,你赢了!")
else:
#dead("You greedy bastard!")
dead("你这个贪婪的混蛋!")
def bear_room():
#print("There is a bear here.")
print("那儿有一只熊。")
#print("The bear has a bunch of honey.")
print("这只熊有一束蜂蜜")
#print("The fat bear is in front of another door.")
print("那只肥熊在另一扇门前。")
#print ("How are you going to move the bear?")
print("你打算怎么移动熊?")
bear_moved = False
while True:
print("""
1、吃点蜂蜜(Take honey)
2、嘲讽熊(taunt bear)
3、开门(open door)
""")
choice = input(">")
if choice == "Take honey":
#dead("The bear looks at you then slaps your face.")
dead("熊看着你,然后扇了你一巴掌。")
elif choice == "taunt bear" and not bear_moved:
#print("The bear has moved from the door.")
print("熊已经离开了门。")
#print("You can go through it now.")
print("你现在可以过去了。")
bear_moved = True
elif choice == "taunt bear" and bear_moved:
#dead("The bear gets pissed off and chews your leg.")
dead("熊生气了,还咬了你的腿。")
elif choice == "open door" and bear_moved:
gold_room()
else:
#print("I got no idea what that means")
print("我不知道那是什么意思")
def cthulhu_room(): #cthulhu 克苏鲁,怪物
#print("Here you see the great evil Cthulhu.")
print("在这里你看到了大恶魔克图尔胡。")
#print("He, it, whatever stares at you and you go insane.")
print("他,它,任何盯着你看的东西,你都会发疯。")
#print("Do you flee for your life or eat your head?")
print("你是逃命还是吃你的头")
print("""
1、逃走(flee)
2、头(head)
""")
choice = input(">")
if "flee" in choice:
start()
elif "head" in choice:
#dead("Well that was tasty!")
dead("好吧,那很好吃!")
else:
cthuluhu_room()
def dead(why):
print(why,"Good job!")
exit(0)
def start():
#print("You are in a dark room.")
print("你在一个黑暗的房间里。")
#print("There is a door to your ritht and left.")
print("有一扇门通向你的左边(left)和右边(right)。")
#print("Which one do you take ?")
print("你选哪一个?")
choice = input(">")
if choice == "left":
bear_room()
elif choice == "ritht":
cthulhu_room()
else:
#dead("You stumble around the until you starve.")
dead("你在附近跌跌撞撞直到饿死。")
start()