Dictionary Problems


Error "Oops, try again. Did you accidentally delete the inventory dictionary? Click Reset Code to get back to the original code."

I think it only triggers the error when I add the list Pocket to inventory

inventory = {
    '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'

# Your code here
inventory['gold'] += 50;

Thanks to anyone that helps!


the problem is here:

'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']

a , is missing at the end to separate key+value pairs


You just need a comma right there:

because you added pocket to the dictionary. Next time read the error message and try to determine what's wrong. :slight_smile:


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