Inventory
列出清单并计算总和
stuff = {'rope':1,'torch':6,'gold coin':42,'dagger':1,'arrow':12}
def displayInventory(stuff):
print('Inventory:')
value_total = 0
for k,v in stuff.items():
print(str(v) + ' ' + k)
value_total += v
print('Total number od items:' + str(value_total))
displayInventory(stuff)