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

I can't past the first task

What else can I do? Except maybe put it closer to the list but I wound up with the same result.

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

]

states.remove (5)

2 Answers

Hi Frank,

This is not going to work because you have physically removed 5 from the array. states.remove(5) will fail if there is no value of 5 in the array. You must leave the array as it was, and follow it with a states.remove(5) command

states = [
    'ACTIVE',
    ['red', 'green', 'blue'],
    'CANCELLED',
    'FINISHED',
    5,
]

states.remove(5)

That code is exactly what I entered, which passes the challenge. If you copy and paste that code block exactly into your challenge you should pass.

Thank you so much and I appreciate you patience. When I completed both tasks I was like "Ohhh"! not realizing the random bracket on the bottom was actually the list itself.