-
-
Save ajfg93/aa78065e6b50e866c52743ab8aeb6e1d to your computer and use it in GitHub Desktop.
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
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