Skip to content

Instantly share code, notes, and snippets.

@brainyfarm
Created August 8, 2016 14:31
Show Gist options
  • Save brainyfarm/c0ddb3cadda9858498500a7aa262c35e to your computer and use it in GitHub Desktop.
Save brainyfarm/c0ddb3cadda9858498500a7aa262c35e to your computer and use it in GitHub Desktop.
FreeCodeCamp: Seek and Destroy (Python)
"""
You will be provided with an initial array (the first argument),
followed by one or more arguments.
Remove all elements from the initial array that are of the same value as these arguments.
"""
def destroyer(*args):
the_list = args[0]
to_remove = list(args[1:])
# Doing some list comprehension
return [element for element in the_list if element not in to_remove]
print destroyer(["tree", "hamburger", 53], "tree", 53)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment