Created
August 8, 2016 14:31
-
-
Save brainyfarm/c0ddb3cadda9858498500a7aa262c35e to your computer and use it in GitHub Desktop.
FreeCodeCamp: Seek and Destroy (Python)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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