itertools.combinations()

  • + 0 comments

    from itertools import combinations

    def combine(s, k): for i in range(1, k+1): var = list(combinations(s, i)) [print(''.join(x)) for x in var]

    s, k = input().split() s = list(s.upper()) # s determined as list s.sort() combine(s, int(k))