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 Collections (Retired) Lists Redux Manipulating Lists

I'm trying to do the 2nd challenge after the Pop video, no matter what I put, it says Task 1 is no longer passing

Please help! I don't know how to fix this

lists.py
the_list = ["a", 2, 3, 1, False, [1, 2, 3]]

# Your code goes below here
the_list.pop(3)
the_list.insert(0, 1)
the_list.remove("a", False, [1, 2, 3])
Shadow Skillz
Shadow Skillz
3,020 Points

I'm also having a issue with this it works in my python shell but not in this code challenge can someone provide a visual example pls

2 Answers

Hi Maya,

The wording on this challenge was a little confusing to me also. Just pop the first 1, don't worry about the other 1 in the list at the end.

Removing your last line should pass the challenge. But, try to do it in one line!

Cheers

I was able to do the first task, just not the second one where it asks you to "use .remove() and/or del to remove the string, Boolean, and list members of the_list." Do you know how to do this one?

Indeed, my appologies! remove() takes one argument and will remove the first item found from the list that matches it's argument.

Python Docs list.remove

I don't know of a way to remove / del multiple items from a list in one line.

del can remove a sequence of elements from a list, but still not sure if it's possible to use just one del to remove these three elements.

Python Docs del statement

Using 3 lines to remove / del 3 elements will work just fine.