Why it is not working?


inventory = {
'gold' : 500,
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']

Adding a key 'burlap bag' and assigning a list to it

inventory['burlap bag'] = ['apple', 'small ruby', 'three-toed sloth']

Sorting the list found under the key 'pouch'


Your code here



Isn't the dagger in the backpack?


I didn't get you .
Please give little bit detail explanation


inventory[gold] is undefined so should raise an exception.

inventory['gold'] is defined, but holds a single value, 500.

'dagger' is in the inventory['backpack'] list.

Do you want to remove 'dagger', or modify the value for 'gold'?


What a silly mistake i have done there .
Thanx for figuring it


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.