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 trialsonam rathore
703 Pointscant complete the last step of lists.py . error is Task1 no longer passing
I am getting an error for states.remove(['red','green','blue'])
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(['red','green','blue'])
3 Answers
Thomas Fildes
22,687 PointsHi Sonam,
What you need to do is remove the second item in the list. You select the index of the states variable by using states[index] in which the second item is 1. Please see below code if still unsure:
states.remove(5) # Task 1 code
states.remove(states[1]) # Task 2 code
Happy coding!
sonam rathore
703 Pointsthank you.
Bradley Voogel
287 PointsI'm also having an issue with this code challenge. It works in terminal but not in the workspace. Does anyone have any ideas?
>>> my_list = [1,2,3,4,5,6]
>>> states = [
... 'ACTIVE',
... ['red', 'green', 'blue'],
... 'CANCELLED',
... 'FINISHED',
... 5,
... ]
>>> states.remove(['red', 'green', 'blue'])
>>> states
['ACTIVE', 'CANCELLED', 'FINISHED', 5]