itertools.combinations()

  • + 0 comments

    from itertools import combinations

    def permutation(): user_input = input() input_list = user_input.split() var1, k = input_list[0], int(input_list[1]) sorted_var1 = "".join(sorted(var1)) for size in range(1, k + 1): for combo in combinations(sorted_var1, size): print("".join(combo))

    if name == "main": permutation()