def purify([1,2,3]):
is_even = []
for i in purify:
odd = (purify += 2)
if i == odd:
return odd

This is my code, obviously something is wrong because it's not working. First Error is def purify([1,2,3]): says the syntax is wrong. Thank you.


A parameter is a variable, not a literal object.

    def purify(old_list):

Removing elements from a list that is being iterated can have negative consequences. This is the sort of thing to avoid. You have an empty working list, so use it to collect only even numbers.

        new_list = []
        for i in old_list:
            if i % 2 == 0:        # test for even parity
        return new_list


Thank you. I'm about to break it down to my understanding. I appreciate it.


Your kind help has allowed me to understand the code! Thank you very much!


A post was split to a new topic: Somehow it doesn't really work for me