Python lists and Dictionaries


14. It's dangerous to go alone.

File "python", line 5
'pocket' : ['seashell' , 'strange berry' , 'lint']
SyntaxError: invalid syntax

I expected it to work. I put in 'pocket' exactly how the other lists were put in in the dictionary.

Replace this line with your code. 
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'
inventory['gold'] = 550



There is a comment # Your code here (Should have been line 14).
All the coding we do for this lesson is placed below that.
You need to add your pocket key under that comment & all the other instructions as well. (You have done most of them, just move them & add your pocket key to the inventory there.

Hint - look at the comment adding a key 'burlap bag', .

Hope that helps, let me know.


Yeah, that did help, thanks.


That is good news. As a learner myself, I know the frustrations, good luck further.


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