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()

why not working

/

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

Can you provide at least a question? Thx. This way the Community can understand about what's your problem.

Not to be mean :smile:

Good luck!

~Alex

this is what i have input into challenge. But it returns that there is error with code. I cannot see the error in my above code?

2 Answers

Try using

states.remove(['red', 'green', 'blue'])

instead of:

states.remove('blue')

Good luck! ~Alex

in this challenge i have to remove only blue. In your suggestion yours would delete the entire list. But to pass this challenge i must only delete blue

Ryan S
Ryan S
27,276 Points

Hi David,

Alex is correct. In the first task it asks you to remove the last item from the states list, which is the number 5. In the second task it asks to you to remove the entire list of colors from the states list. You might be trying to remove the last item from the wrong list.

Good luck.