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
|
908 Discussions
|
Please Login in order to post a comment
Here is the solution:
from itertools import permutations s,k = input().split() res = sorted(permutations(s,int(k))) for i in res: print("".join(i))
from itertools import permutations s,k=input().split() k=int(k) result=sorted(permutations(s,k)) for perm in result: print("".join(perm))
from itertools import permutations string, k= input().split() [print(*i , sep="") for i in list(permutations(sorted(string),int(k)))]