Practice Makes Perfect - 12.Purify



I am getting the correct o/p but system prompts me "Oops, try again. Your function fails on purify([1]). It returns [2, 4, 6, 8] when it should return [].", Though when i checked for purify([1]) as input, my output was [], i.e correct.

hence why the prompt??

new = []
def purify(num):
    for key in range(0, len(num)):
        if num[key]%2 == 0:
    return new    
print purify([1])


the exercise runs multiply test on your function, because you declare new outside you function, leftovers from the previous run might stick around

Declare the empty list new inside your function