Inv={' gold coin: 42, "rope" : 1}
DragonLoot=[' gold coin ', 'gold coin', 'rope']
Def addToInventory (inventory1 addedItems) :
For p in the range (0, len (addedItems) :
If addedItems [p] not in inventory1. Keys () :
Inventory1. Setdefault (addedItems [p], 1)
The else:
Inventory1 [addedItems [p]]=inventory1 [addedItems [p]] + 1
Av=addToInventory (inv, dragonLoot)
Print (av)