9. Removing a few things


#1



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

There's something wrong with the code on this page.

If I take backpack = ['xylophone', 'dagger', 'tent', 'bread loaf'] and put it into IDLE, I am able to code several difference solutions that make this code work.

No matter which way I put it into Codecademy's interpreter, I can an "Oops" message every time.

Here's my code straight from IDLE:

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

#I also attempted removing additional items using del and it also works
>>> del backpack[1]
>>> print backpack
['xylophone', 'bread loaf']

I believe this particular tutorial is broken.


#2

@aarontlee,
Have you tried a Browser reset
and give the EXACT Oops-message....

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).


#3

backpack is a member of inventory.


#4

tutorial 9.13 not 9.14


#5

    inventory['backpack'].remove('dagger')

#6

So that tutorial doesn't have the word "Inventory" in it.

strangely, however, all I did was hit submit code on it again and magically, it just started working.


#7

3 posts were split to a new topic: Is there a difference between del and remove


#8