Python Python Collections (2016, retired 2019) Lists Removing items from a list

Why isn't this working?

I am trying to move the one to the front of the list and it is not working.
messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]

# Your code goes below here
del messy_list[3]
messy_list.insert(0, '1')

1 Answer

Dima Mykhaylov
Dima Mykhaylov
18,697 Points

The issue is it wants you to use the pop() method so use that instead of del.

This should work

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