What’s wrong with my code?
I do not get the expected output

def purify (list_arg):
  for item in list_arg:
    if item % 2 == 1:
  return list_arg


to get output, you need to call the functions.

remember that functions do not execute unless called

uhm… .remove() is a difficult approach given you have to deal with index shift which causes succesive uneven/odd numbers to be skipped


Hi, @designwhiz61809 ,

The instructions include this …

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

That is good advice, in part because of the issue raised above by @stetim94 regarding the remove method.


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