Python Python Collections Lists Removing items from a list

Rocco Soucie
Rocco Soucie
559 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
559 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,768 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))