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

Rocco Soucie
Rocco Soucie
1,018 Points

Python "Pop Quiz" doesn't accept my answer to my problem.

I am on the "Pop" quiz, and I have done what the program asked, but it keeps telling me that I need to use ".insert" and ".pop", but I did. I have tested it in my workspace, and it works just as it's supposed to. I do not know what it wants from me. Please help!

lists.py
messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]
messy_list.insert( 0, (messy_list.pop(3)))
# Your code goes below here
Rocco Soucie
Rocco Soucie
1,018 Points

I also created a more spread out version that works, but it doesn't accept here.

Code: messy_list = ["a", 2, 3, 1, False, [1, 2, 3]] wrong_number = messy_list.pop(3) messy_list.insert( 0, wrong_number) print(messy_list)

1 Answer

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Yes, your code does work in the REPL which I think is just a little more forgiving than the challenge checker.

Removing extra parenthesis and the space before the zero does get accepted

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