Created
August 8, 2016 09:46
-
-
Save brainyfarm/65c61e12b825c5fffc984fac582054c8 to your computer and use it in GitHub Desktop.
FreeCodeCamp: Slasher Flick (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
""" | |
Return the remaining elements of an array after chopping off n elements from the head. | |
The head means the beginning of the array, or the zeroth index. | |
""" | |
def slasher(the_list, n): | |
if(n >= len(the_list)): | |
return [] | |
while(n > 0): | |
the_list.remove(the_list[0]) | |
n -= 1 | |
return the_list | |
print slasher(["burgers", "fries", "shake"], 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment