I dont know whats the problem can anyone help me?



it says "Oops, try again. Does your purify function take exactly one argument (a list of numbers)? Your code threw a "'int' object is not iterable" error."

I thought it will work and it will remove all the odd numbers that are in the list.

def purify(numbers):
    if len(numbers)>1:
        for i in numbers:
            if i%2==0:
        if numbers%2==0:
    return y


You can't add an int to a list by typing y += i.
You need to use the append attribute: y.append(i)

And you trying to divide the list by an int, that doesn't work also.

And these syntax errors lead you to an false end, and makes whole progress unnecessarily complex which I can't help in that complexity.

Therefore I want to share an elegant and simple solution with you:

def purify(liz):
    meow = [x for x in liz if (x % 2 == 0)]
    return meow


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