itertools.permutations()

  • + 0 comments

    from itertools import permutations def permutation(): user_input = input() input_list = user_input.split() var1, var2 = input_list[0], int(input_list[1]) k = list(permutations(var1, var2)) new_list = ["".join(i) for i in k] for element in sorted(new_list): print(element) if name == "main": permutation()