Feb-17-2022, 10:43 PM
(This post was last modified: Feb-17-2022, 10:46 PM by Gribouillis.)
These kinds of permutations are called «Arrangements» in classical mathematical literature (although there may be more modern terms to refer to them) See the paragraph about k-permutations of n here https://en.wikipedia.org/wiki/Permutatio...tions_of_n (note that these are only the 'restricted partial premutations' in https://en.wikipedia.org/wiki/Partial_pe...rmutations)
The following piece of code should do the trick
The following piece of code should do the trick
s = "abcde" n = len(s) seq = (a for i in range(1, n+1) for c in itt.combinations(s, i) for a in itt.permutations(c, i)) for x in seq: print(x)