Purify: why does it give me an error?


It isnt working as expected

def purify(ysh):
    for i,j in enumerate(ysh):
        if j%2!=0:
    return ysh


It states in the instructions:

Do not directly modify the list you are given as input; instead, return a new list with only the even numbers.

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

I would always try to shoot for simplicty, it gets hard enough as it is :slight_smile: