Python Python Basics (2015) Python Data Types Lists

alan ingram
PRO
alan ingram
Pro Student 3,839 Points

Is it me or the site?

I am doing workspace challenge and I have to remove the "5" from the list, then the next screen has me remove the list from within the list. However, the "5" I just got done removing is still there and now my code crashes because the "5" is still there. I passed one screen and now failing the next, based on a challenge I already completed. Was there something else I was supposed to do? states = [ 'ACTIVE', ['red', 'green', 'blue'], 'CANCELLED', 'FINISHED', 5, ] states.remove(['red', 'green', 'blue'])

5 Answers

alan ingram
PRO
alan ingram
Pro Student 3,839 Points

I figured it out, I had to make a ink and paper list myself and through process of elimination wrote each option I tried that failed. For some reason I never thought you had to reference the entire list inside the function to delete it. but as soon as I tried, "remove([list items1, list items2, ..])", it deleted. Maybe we can go back to doing computing on stone tablets or paper.

You replaced the code you've written in the previous task, but you aren't supposed to remove the work you did.

Put in your code you wrote in the previous task and it should pass.

james south
james south
Front End Web Development Techdegree Graduate 33,249 Points

did you replace the line where you removed the 5, or did you leave it and write a new line below it for task 2? the challenges state that you should leave the code from each task in place when doing subsequent tasks.

alan ingram
PRO
alan ingram
Pro Student 3,839 Points

I left everything as is. The directions did not indicate that I should make a new line or print anything out. So when you go to the next page, the 5 is still there - eventhough it was correctly removed in the previous screen.

Savanna Sullivan
Savanna Sullivan
924 Points

I defined the list to be removed as a variable, then removed it using states.remove(list) Hope this helps :)