练习45 源代码
from sys import exit #sys.exit是退出程序的方法def gold_room(): print("This room is full of gold. How much do you take?")choice input("> ")if "0" in choice or "1" in choice: #choice变量中的字符串含…
这是一个简单的游戏,主要是使用了函数的定义,不同的分支调用
from sys import exit #exit(0)无错误退出,exit(1)有错误退出def gold_room():print("This room is full of gold,how much do you want to take?")next input(>)if …