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

Alistair Murphy
Alistair Murphy
743 Points

What to remove ? and how? i'm doing .remove () :S

Tried alot of things to remove with "states" being the list name and with out. its unclear and i'm getting syntax error a lot that i'm not sure why .

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

4 Answers

since you are calling the remove() method on states you should remove the space between the 2, also it should be remove(something) not remove [something], if you are removing list items then you would do some_list.remove([1, 2])

Alistair Murphy
Alistair Murphy
743 Points

I have adjusted accordingly e.g states.remove (5)

But now its just saying - Did you use .remove()?

you still have a space in states.remove (5) it should be states.remove(5)

Alistair Murphy
Alistair Murphy
743 Points

Oh yeah, spot on Susanna not used to such precise matters. will learn though :) all good !!!