Lists in dictionaries


Hi guys, someone can help me with this exercise? Thanks

Replace this line with your code.


Hi @systemninja32530,

We cannot help you unless you post your code (required), and the error you are receiving (optional). :slight_smile:


Sorry, I had forgotten.
This is my complete code:
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

inventory['pocket']=['seashell', 'strange berry', 'lint']
k = inventory['backpack']
a = inventory['backpack']
inventory['gold'] + 50

And this is the error I have:
Oops, try again. Make sure to add 50 to the gold total!


What is the variable k for? You are only supposed to add a key to inventory called pocket the same way you added a key named burlap bag here,

And then sort the backpack key using the .sort() method,


Please fix those errors first, and then try follow the instructions but if you still need help feel free to ask. :slight_smile:


I have solved...thank you for your help!


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