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

cant 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!

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

3 Answers

For 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 you are the best! thanx!

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

thats worked but why the 'states'?

We 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.

its happend in the second task agine. its ask me to remove the secong item but still its doesnt worked also with the 'states.remove()'