12.purify stucked here..!



def purify(numbers):
    for i in n:
        if i%2==0:
            print i


The instructions
Define a function called purify that takes in a list of numbers,
removes all odd numbers in the list, and returns the result.

For example, purify([1,2,3]) should return [2].

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


First of all,


doesn't create a copy of the list, numbers, called n. It just created another variable name (n) for the same list. So when you change n or numbers, it will affect the same list.Try creating a new empty list or use another method to copy the list.
Another thing is, if you put


in the loop, you are basically saying, if an item in the list is not even, exit the loop. So, if your list is this: [1,2,3], when the code runs on the first item, 1, it will exit the loop and produce the list [1,2,3] as you did nothing to it. You don't necessarily need this.

I believe you also forgot a return statement.