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 trialJesse mendoza
452 Pointshow do you remove a list of words from a list using remove()
for example. how do you remove ['red','green','blue'] using remove() ? i have tried so many ways and i cant seem to figure it out
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(['red', 'green', 'blue'])
1 Answer
Steven Parker
231,236 PointsAs Mattias mentioned, remove can take a list as an argument.
But the real issue here is that the tasks build on each other, so the work done for task 1 should remain as-is when you add the work for task 2. So you need to put back the code that allowed you to pass task 1.
Mattias Nelson
961 PointsMattias Nelson
961 PointsNote: I'm still learning the world of Python myself, so keep that in mind while reading this reply!
Your syntax looks to be fine, and I plugged in your code into workspaces. What you currently have does indeed successfully remove the list ['red', 'green', 'blue].
Are you currently stuck on the challenge, or were you trying to experiment while within the challenge?