Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 24, 2016 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/4081c175482abf29ba022650a0097985 to your computer and use it in GitHub Desktop.
Save codecademydev/4081c175482abf29ba022650a0097985 to your computer and use it in GitHub Desktop.
Codecademy export
def is_even(x):
if x % 2 == 0:
return True
else:
return False
def purify(x):
for item in x:
if item % 2 != 0:
x.remove(item)
return x
@bayoishola20
Copy link

How about you do this instead.

result = []
def purify(x):
    for item in x:
        if item % 2 == 0:
            result.append(item)
    return result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment