It's Dangerous to Go Alone! Take This


#1



https://www.codecademy.com/en/courses/python-beginner-en-pwmb1/2/5?curriculum_id=4f89dab3d788890003000096


Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: 'dict' object has no attribute 'sort'


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'
inventory['pouch'].sort() 

# Your code here
inventory['pocket'] = ['seashell', 'strange berry', 'lint']
inventory.sort('backpack')
inventory.remove('dagger')
inventory['gold'] = 500 + 50


#2

look at this two lines:

inventory['pouch'].sort() 
inventory.sort('backpack')

both sort a list, but one is correctly, and the other is not


#3

Thanks I have used the first line and it now works. Thanks for your help :smile:


#4