Python Python Basics (2015) Python Data Types list.remove()

Task evaluator not working.

This should work but the evaluator says it doesn't pass. Anyone know why?

states = [ 'ACTIVE', ['red', 'green', 'blue'], 'CANCELLED', 'FINISHED', 5, ] states.remove(['red', 'green', 'blue'])

lists.py
states = [
    'ACTIVE',
    ['red', 'green', 'blue'],
    'CANCELLED',
    'FINISHED',
    5,
]
states.remove(['red', 'green', 'blue'])

8 Answers

Matt Hanson
MOD
Matt Hanson
Treehouse Moderator 17,671 Points

This challenge wants you to remove the last item in the list (5) on the first step. On step two you'll remove the nested list of colors.

I was on step 2.

Matt Hanson
Matt Hanson
Treehouse Moderator 17,671 Points

Did you happen to delete your line of code from step 1? What message did it give you?

Unfortunately there is no way to add a screenshot but I assure you step 2 is where I am at.

Step 1 passed fine. Step 2 says this... Challenge Task 2 of 2 OK, one more removal. See that second item in states? It's a list of colors and doesn't belong here. Can you get rid of it for me? Be sure to use .remove() again. With the code given it should work. I think it's a bug. Hopefully not.

Matt Hanson
MOD
Matt Hanson
Treehouse Moderator 17,671 Points

I just went through the challenge using the same line you posted, as well as the line for deleting the number 5 from the list, and it passed just fine. What is the message being displayed when it fails?

There error is... Oops! It looks like Task 1 is no longer passing. Maybe i'll clear my cache and try again later or something. Seems the code is fine.

Matt Hanson
Matt Hanson
Treehouse Moderator 17,671 Points

What I'm saying is that you still need the line of code from the first step in there in order to pass step 2. I'm not seeing it in your code you posted.

Matt Hanson
MOD
Matt Hanson
Treehouse Moderator 17,671 Points

This is what I used. You need both 'remove' calls in there.

states = [
    'ACTIVE',
    ['red', 'green', 'blue'],
    'CANCELLED',
    'FINISHED',
    5,
]
states.remove(5)
states.remove(['red', 'green', 'blue'])

oic, I'm with you now. Didn't realize that.