You are viewing a single comment's thread. Return to all comments →
from itertools import permutations def print_permutations(elements: list, n_permuts: int): print( *["".join(permut) for permut in sorted(list(permutations(elements, n_permuts)))], sep="\n" ) if __name__ == '__main__': string, n_permuts = tuple(input().split(" ")) print_permutations(list(string), int(n_permuts))
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.permutations()
You are viewing a single comment's thread. Return to all comments →