Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Python Data Types list.remove()

Alistair Murphy
Alistair Murphy
743 Points

still stuck on this, please somebody "did you use .romove () error ?

put me out of my misery i beg xD

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

1 Answer

andren
andren
28,538 Points

There are two issues:

  1. The first task asks you to remove the number 5 from the list, you are not doing that in your current code which is an issue since you need to keep the code from each task around in multi-task challenges like this.

  2. The challenge checker can at times be pretty picky about how your code looks. It doesn't like the fact that you have a space between the remove method and its parenthesis, so you have to remove that space.

If you fix those two issues like this:

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

Then you will be able to pass the challenge.

Alistair Murphy
Alistair Murphy
743 Points

Thank you, yeah moments after posting this i adjusted the space and got it and the following :)