Skip to content

Instantly share code, notes, and snippets.

@brainyfarm
Created August 8, 2016 09:46
Show Gist options
  • Save brainyfarm/65c61e12b825c5fffc984fac582054c8 to your computer and use it in GitHub Desktop.
Save brainyfarm/65c61e12b825c5fffc984fac582054c8 to your computer and use it in GitHub Desktop.
FreeCodeCamp: Slasher Flick (Python)
"""
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