-
-
Save ajfg93/8accdcb540d0e1006f4b789a894f45d7 to your computer and use it in GitHub Desktop.
This file contains 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 qpl(sz, index): | |
if len(sz) == index: | |
print(sz) | |
return | |
else: | |
for x in range(index, len(sz)): | |
if x == 0: | |
new_array = sz[:] | |
qpl(new_array, index + 1) | |
else: | |
temp = sz[0] | |
sz[0] = sz[x] | |
sz[x] = temp | |
new_array = sz[:] | |
qpl(new_array, index + 1) | |
def main(): | |
a = [1, 2, 3, 4] | |
qpl(a, 0) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment