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 trialMichael Ryadi
211 PointsDon't understand. Try to remove the blue, is not working. states.remove('blue')
Hi All,
Need assistance here.. :) Try to remove with states.remove('blue'), but it didn't work.
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(['blue'])
3 Answers
Tobias Helmrich
31,603 PointsHey Michael,
if you're talking about the first challenge then you have to remove the last item of the list which is 5. You're removing the last item of the list inside of the list.
This should do it:
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(5)
I hope that helps! Good luck! :)
Steven Parker
231,248 PointsAre you sure you read the challenge instructions correctly? That doesn't seem to be part of the challenge your link points to. Task one of the challenge is to remove the last item, not the last color. Task 2 is to remove all the colors.
However, if you did want to remove 'blue', notice that it is not part of the states list directly but is part of the nested collection in states[1].
Michael Ryadi
211 PointsOkay.. my bad. :) I thought the list that mentioned in instruction was the colors.
Thanks Tobias, Steven. It's okay now. :)