I'm starting to learn the basics in Python, and one of the examples on dictionary lists asks for something like this:
inventory = {'a' : 1 , 'b' : 6 , 'c' : 42 , 'd' : 1 , 'e' : 12}
def DisplayInventory(stuff):
for k,v in stuff.items():
stuff = k + v.get(stuff,0)
print(k+v)
DisplayInventory(inventory)
But I still have this error:
Traceback (most recent call last):
line 8, in <module>
DisplayInventory(a)
line 5, in DisplayInventory
stuff = k + v.get(stuff,0)
AttributeError: 'int' object has no attribute 'get'