Don't know whats wrong...Please suggest


Add a key to inventory called 'pocket'
Set the value of 'pocket' to be a list consisting of the strings 'seashell', 'strange berry', and 'lint'
.sort() the items in the list stored under the 'backpack' key
Then .remove('dagger') from the list of items stored under the 'backpack' key
Add 50 to the number stored under the 'gold' key


nventory = {
'gold' : 500,
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf'],
'pocket' : ['seashell', 'strange berry', 'lint']

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'

print inventory['gold'] + 50

Your code here

Output: Oops, try again. Make sure to add 50 to the gold total!


print inventory['gold'] + 50

does not change the value, stored under the 'gold' key.

a = 5
print a + 50 #prints 55
print a # prints 5
a = a + 50
print a #prints 55, the value stored in a was changed

To change the value stored under an "example" key use:
inventory["example"] = inventory["example"] + 50
inventory["example"] += 50


Its working.....Thanks a lot :slight_smile: