It's Dangerous To Go Alone! Question


Traceback (most recent call last):
File "python", line 14, in
AttributeError: 'str' 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'

# Your code here
inventory['pocket'] = ['seashell', 'strange berry', 'lint']
inventory['gold']= 550


this line:


you can't sort a string, you should sort a list (backpack list, which is part of your inventory dictionary)


I edited my code to look like this:

And I took your advice, but it came up with this error:


take a look at line 11 how the pouch list inside the inventory dictionary gets sorted. you should call sort on the list, not pass it as argument


Ah, thank you. I completely overlooked that.