money = 0
Pickaxes = {
'adamant pickaxe': {'cost': 100, 'speed': 5},
'bronze pickaxe': {'cost': 100, 'speed': 5},
'dragon pickaxe': {'cost': 100, 'speed': 5},
'inferno adze ': {'cost': 100, 'speed': 5},
'iron pickaxe': {'cost': 100, 'speed': 5},
'mithril pickaxe': {'cost': 100, 'speed': 5},
'rune pickaxe': {'cost': 100, 'speed': 5},
'steel pickaxe': {'cost': 100, 'speed': 5}}
def shop():
global cost
print "Welcome to Alister's goods!"
time.sleep(2)
sellbuy = raw_input("\nWould you like to sell or buy goods?:\n")
if sellbuy == "sell":
sell()
else:
print "\nHere is a list of our goods....\n"
for i in Pickaxes:
print i
what_item = raw_input("\nWhich item would you like to purchase?\n")
if what_item in Pickaxes and money >= Pickaxes[what_item]["cost"]:
inventory.append[what_item]
print "You have successfully purchased a", what_item
start()
我的商店定义停止工作时,你键入的项目,你想在原始输入它只是停止程序没有错误,这是一个更大的程序的一部分,这就是为什么它在一个定义等。。。。你知道吗
谢谢
根据你的代码,钱是0,这意味着它永远不会进入那个条件,程序只是退出。(您可能还想添加一些东西,以减少购买后的钱,而你是在它)
你应该抓住那个条件
或者在一段时间内循环购买:
相关问题 更多 >
编程相关推荐