You are viewing a single comment's thread. Return to all comments →
from itertools import combinations n = input().split(); aa = n[0] b = int(n[1]) a = sorted(aa); combination_list = []; for i in range(1, b+1): combination = list(combinations(a,i)) combination_list.extend(combination) for element in combination_list: for char in element: print(char, end=""); print("")
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 →