List.remove(x) error


#1



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


Traceback (most recent call last):
File "python", line 16, in
ValueError: list.remove(x): x not in list


The program should have run, but for some reason it encountered this error. Please help!


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']
backpack.sort()
backpack.remove('dagger')
inventory['gold' : 550]


#2

here you're making mistake and it goes(error) to down( code after this depends on it)..

backpack.sort()

Hint**
Read instruction again!


#3

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