Dangerous to go alone help


inventory = {'pocket' : ['seashell', 'strange berry', 'lint']
    '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
inventory['gold'] = inventory['gold'] + 50

Please help says did you delete inventory dictionary


{'pocket' : ['seashell', 'strange berry', 'lint'] There is no comma at the end of this line, so your dictionary never gets created. You just get a SyntaxError.


thankyou so much has taken me so long to figure this out. Cheers!


in this case, the error message of the exercise tells you something might be wrong with your dictionary, then loop at the error message in the interpreter:

  File "python", line 2
    'gold' : 500,
SyntaxError: invalid syntax

which can help you pinpoint the problem, also, always look to the line above the error message (especially with dictionaries, but in other cases you might have not matching parentheses or something)

Just some info on how to debug (debugging is important)


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