We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
itertools.combinations()
itertools.combinations()
Sort by
recency
|
928 Discussions
|
Please Login in order to post a comment
from itertools import combinations q,r = input().split() q=sorted(q) r=int(r) for t in range(1,r + 1): for bond in combinations(q,t): print("".join(bond))
The shortest code I could write…