You are viewing a single comment's thread. Return to all 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))
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.combinations()
You are viewing a single comment's thread. Return to all 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))