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 trialor porat
684 Pointscant pass this quetstion..
hey! its ask me to use the '.remove()' to remove the last item for the list. i tried to do to for 'blue' and 'FINISHED' and '5' but they all wrong. what should i do? thanx!
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
.remove ('blue')
3 Answers
Michael Guay
5,297 PointsFor the second part of the challenge you'll want to use the same method as the first, but instead of removing the 5, we are removing the entire list. Try this:
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(5)
states.remove(['red', 'green', 'blue'])
Michael Guay
5,297 PointsYou are going to want to remove the last item in the list, which is the integer 5. Try this code out, it worked for me -
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(5)
or porat
684 Pointsthats worked but why the 'states'?
Michael Guay
5,297 PointsWe are saying states.remove() because we need to tell the remove method which list to remove items from, in this case it is the states list.
or porat
684 Pointsits happend in the second task agine. its ask me to remove the secong item but still its doesnt worked also with the 'states.remove()'
or porat
684 Pointsor porat
684 Pointsmichael you are the best! thanx!