Can't sort inventory, keeps getting error!


#1



Hey all! I'm having an issue with this exercise and hoping someone could point me in the right direction?!

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


The error message keeps asking me "Did you remember to sort the list at inventory ['backpack']?


I thought this what the right syntax?

inventory['backpack'].sort()

<do not remove the three backticks below>

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() 

inventory['pocket'] = ["seashell", "strange berry", "lint"]
inventory['backpack'].sort()
inventory['backpack'].remove("dagger")
inventory['backpack'].append(50)
print inventory




#2

The lesson checker doesn't have a response to match the above error. You will want to add 50 to the 500 for gold.


#3

Thanks for the help! Error solved.


#4

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