What is wrong?


#1

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

what is wrong with below codes:

def purify(sequence):
    result = []
  for i in sequence:
    if i % 2 == 0:
      result.append(i)
  return result
print purify([1,2,3,4])

#2

The first thing one suspects is the indentation on the return line. We can’t really tell.

Edit

After formatting your post that doesn’t seem to be the problem. Is there an error message from the lesson checker or the console?

There will be an error raised by the interpreter because of the unmatched indent on lines 2 and 3.


#3

there is no error message, and I compared with the answer, I think my answer is correct