I need to removes all odd numbers in the list, and returns the result.
For example, purify([1,2,3]) should return [2]
My function is
def purify(num):
for x in num:
if x%2 != 0:
num.remove(x)
return num
So for purify([4, 5, 5, 4]). It returns [4, 5, 4] when it should return [4, 4].