Skip to content

Instantly share code, notes, and snippets.

@sakekasi
Created November 20, 2017 06:19
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 sakekasi/e3413e64d72735e95044a977d258c3cd to your computer and use it in GitHub Desktop.
Save sakekasi/e3413e64d72735e95044a977d258c3cd to your computer and use it in GitHub Desktop.
mystery
def mystery(lst, n):
if n == 0:
return lst
elif lst == []:
return lst
else:
return mystery(lst[1:], n-1) + [lst[0]]
ans = mystery([1,3,4,7,9], 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment