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.permutations()
itertools.permutations()
Sort by
recency
|
913 Discussions
|
Please Login in order to post a comment
If you're stuck generating permutations, just sort the string first! Might even help with your lunchtime bonus prediction for today if you're mixing up options.
from itertools import permutations
s,n = input().split() n = int(n) result = sorted(list(permutations(s,n)))
for i in result: print(''.join(i))