15. Purify (done what it asks, but im still wrong?)


#1



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

Oops, try again. Your function crashed on [1] as input because your function throws a "'NoneType' object is not iterable" error.

i don't understand what i did wrong it worked, i followed the instructions it doesn't effect the original list, it creates its own and removes all odd numbers.....so whats the problem i keep getting the same error message (above) thank you for your time :slight_smile:


list_numbers = [1,1,1,1,1,2,3,4,5,6,7,8,2,2,2,2]

def purify(num):
    results = []
    counter = 0
    for x in num:
        if x % 2 == 0:
            results.append(x)
    counter += 1
    print results

print list_numbers    
    
purify(list_numbers)

print list_numbers


#2

you code is correct , you just should return results not print it

`


#3

god ■■■■ it, its always the simplest solution that inst obvious. thank you so much it was frustrating me a lot