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 (2016, retired 2019) Lists Removing items from a list

Messy List

messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]

messy_list.insert(1, messy_list.pop(3))

messy_list.remove("a") messy_list.remove(False) messy_list.remove([1, 2, 3]) print(messy_list)

1 Answer

Hey Parvati! You have not asked an actual question, please make sure to do this in the future. That being said im assuming your trying to ask why your code dosent pass.

Two things are wrong with your code. 1) You were asked to insert what is contained at index 3 of the list (the number 1), to position 0 in the list. You have moved it to position 1.

2) Your printing the list at the end of your code, but you were never asked to do that, and so it wont pass either (never do anything in the code challenges unless you were explicitely asked to do so)

At the end your code should look like this:

messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]

messy_list.insert(0, messy_list.pop(3))


Hope this helps!