Skip to content

Instantly share code, notes, and snippets.

@ajfg93
Created March 22, 2018 01:07
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 ajfg93/aa78065e6b50e866c52743ab8aeb6e1d to your computer and use it in GitHub Desktop.
Save ajfg93/aa78065e6b50e866c52743ab8aeb6e1d to your computer and use it in GitHub Desktop.
def zuhe(sz, a_list, index):
if not index <= len(sz):
print("FUCK YOURSELF")
return
if index == 1:
for x in sz:
new_array = a_list[:]
new_array.append(x)
print(new_array)
else:
for x in range(0, len(sz)):
if len(sz) - x >= index:
a_list_copy = a_list[:]
a_list_copy.append(sz[x])
pass_in = sz[x + 1:]
zuhe(pass_in, a_list_copy, index - 1)
def main():
a = [1, 2, 3, 4,5]
n = 3
zuhe(a, [], n)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment