I added some debug statements to my code. I am copying x into y to begin with because if I just use x and use the remove on that it skips the second 5 in the list. But it is still doing this even though I am looping through x while editing y. It appears to edit y as well as x which I don't understand.
I get "Oops, try again. Your function fails on purify([4, 5, 5, 4]). It returns [4, 5, 4] when it should return [4, 4]." My code removes objects from my list "x"
It should only remove objects from my list y. I believe my code should do what it is supposed to do.
def purify(x): y = x for n in x: print n print n % 2 if n % 2 != 0: print y y.remove(n) print y print x return y print purify([4,5,5,4])