Confused re: Purify


i get the following error message:
'Your function fails on purify([4, 5, 5, 4]). It returns [] when it should return [4, 4].'

Confused because it looks like it will remove just the odd numbers.

def purify(lest):

    for i in range(len(lest)):
        if i % 2 != 0 :
    return lest


That line is wiping out the parameter value and should be removed.


When I remove that line, I get the following error:

Your code looks a bit off--it threw a "list.remove(x): x not in list" error. Check the Hint if you need help!


got it, that makes sense. thanks!


This exercise is more about learning to do things step by step as opposed to reaching for a built-in function. Not that it's wrong to use the best tool at hand, but it should wait until we know the step by step approaches and understand them well enough to appreciate what the built in function is doing.

Can you find a way to do this lesson without using remove?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.