Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

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.

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.

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.

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.

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.