13. Remove a Few Things


#1



I keep getting the following error.

"Oops, try again. backpack has to be a list! Click Reset Code to get back to the original code."

What do you think I am doing wrong?


I am expecting to remove 'dagger' from the list


Replace this line with your code. 

backpack = ['xylophone', 'dagger', 'tent', 'bread loaf']
backpack.remove('dagger')
print backpack


#2

this:

backpack = ['xylophone', 'dagger', 'tent', 'bread loaf']

will not at a list to your dictionary. It will overwrite your dictionary with a list


#3

Okay. So how do you fix this? I am unsure.


#4

add the list to your dictionary? don't overwrite your dictionary


#5

What? I'm confused.

So add the list to my dictionary?


#6

yea, look:

backpack = ['xylophone', 'dagger', 'tent', 'bread loaf']
print backpack

see how backpack is a list now? It was a dictionary, it was suppose to stay a dictionary and the list should be added to the dictionary.

if you need a syntax refresher, see 11. new entries


#7

Thank you. Such a small thing but it made all the difference.


#8