请问这段程序哪里错误了?求指教,错误显示
#displayInventory(inv)
NameError: name 'inv' is not defined
suff={'rope':1,'torch':6,'gold coin':42,'dagger':1,'arrow':12}
def displayInventory(inventory):
print('Inventory')
for x,y in inventory.items():
print(str(y)+' '+x)
itemTotal=0
itemTotal += y
print('The number of total '+str(itemTotal))
displayInventory(suff)
def addToInventory(inventory,addedItems):
#you coda gose here
inv={'gold coin':42,'rope':1}
dragonLoot=['gold coin','dagger','gold coin','gold coin','ruby']
inv=addToInventory(inv,dragonLoot)
displayInventory(inv)