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

angel moreta
angel moreta
153 Points

I don't understand, I need hints no answers ?

I am working my brain, some help would be a jumpstart. Ok i don't understand what i am doing wrong here i type the same syntax on Atom and i run it on my terminal and boom i get a beautiful [1,2,3] no errors no problems, but in the code challenge something always pops up and it says (Bummer! Looks like you still need to remove some items from messy_list.)

i was wondering if there is any way to get through this challenge, I DON'T want answers but hints will be appreciated

my question : Great! Now use .remove() and/or del to remove the string, the boolean, and the list from inside of messy_list. When you're done, messy_list should have only integers in it.

my syntax: [alt text]https://w.trhou.se/5lmirbgtkr

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

# Your code goes below here
poppep = messy_list.pop(3)
messy_list.insert(0,poppep)
def function(cleaner):
    for each in cleaner:
        messy_list.remove(each)
    return messy_list

1 Answer

Why are you making a function? It seems unnecessary... But if you would like to use a function, remember to call it.

Also, in your function, you are removing every single element in the list. The problem only asked you to remove the non-integers.

Happy coding! :zap: ~Alex