It's Dangerous To Go Alone! Take This


Here is my code, which isn't working.

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']
inventory['backpack']=['xylophone', 'bedroll', 'bread loaf']
inventory['gold']=500 + 50
print inventory

Error message: Oops, try again. Did you remember to sort the list at inventory["backpack"]?

I'm confused because it looks to me like I have called the sort function for backpack. Can someone please explain what I'm doing wrong?

Thank you!


You had sorted the list successfully. But

inventory['backpack']=['xylophone', 'bedroll', 'bread loaf']

This line reordered the list. The list is not in alphabetical order.


Solved-- thank you! :slight_smile:


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