Purify


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/2?curriculum_id=4f89dab3d788890003000096#


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.


Can someone please help me out. I have no idea why I am getting this error message....


def purify(lst):
    new = []
    
    for i in lst:
        if i % 2 == 0:
            new += i
    return new


#2

The following will not add i to the list ...

new += i

You can do it either this way ...

new += [i]

... or this way ...

new.append(i)

#3

It worked! Thanks so much!


#4