List doesn’t exactly support removing values in arbitrary locations, instead deletion is a combination of several other operations – moving all the following values and then resizing to be 1 smaller:
def del(ls, i):
for j in range(i+1, len(ls)):
ls[i - 1] = ls[i]
It’s probably not what you mean.
The task isn’t about making deletions on an existing list, it’s about obtaining a list where even values are not included.
A better strategy would be to move the values to keep to the front, and then resize it, or, better yet, create an entirely new list with only the values to keep.
In terms of how many steps it should reasonably involve, you should only iterate through the list once or twice, so for example a list of size 1000 should take about 1000 steps, but with what you’re doing you’ll end up with closer to 500000 steps as a result of moving everything around on each deletion rather than putting each thing where it should go and then never moving it again.
As has been mentioned, the indices change when you move things around and you would have to adjust for that each time you do it. But it’s kind of pointless to fix that bug since it’s the wrong thing to do anyway.