Purify, working code, not passing


#1

I’ve checked the following code in python visualizer and it works, but for some reason it is not being accepted as an answer and I am not receiving any error messages.

def purify(numbers):
for i in numbers:
if i%2 != 0:
numbers.remove(i)
return numbers

Can anyone explain why this is happening?


#2

Others can’t try running that unless they get an exact copy of it.
Are there no indications whatsoever for why your code fails? No red text from codecademy explaining which test case it fails on?

I suspect your function does not correctly handle this input:

[1, 1, 1, 2, 2, 2]

#3

nevermind, I figured it out.


#4

I was not getting the error messages on failure


#5

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