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

Need help with python code challenge .remove()

I don't understand how to complete the challenge:

Ugh, I made this list and now it has some invalid pieces in it. Maybe you can help me clean it up.Use the .remove() method to remove the last item from the list, please.

Here is what i have written:

states = [

'ACTIVE',

['red', 'green', 'blue'],

'CANCELLED',

'FINISHED',

5,

states.remove(blue)  <-- i added this

]

2 Answers

Maybe you copy and pasted the code wrong, but from what you have here it looks like you have the states.remove() statement inside of the states list (or dictionary, whichever is the proper term for Python). I would try it out myself but I'm not sure what challenge you are on. Also, knowing what error message you are getting would help us with knowing what the issue might be.

The question is actually telling you to remove the 5 not blue. This should solve the problem. Let me know if you have any more issues.