itertools.permutations()

Sort by

recency

|

957 Discussions

|

  • + 0 comments
    from itertools import permutations
    S, k = input().split()
    ki = int(k)
    Sf = [i for i in S if i.isalpha() is True]
    Sf.sort()
    lp = list(permutations(Sf, ki))
    for p in lp:
        print(''.join(p))
    
  • + 0 comments
    from itertools import permutations
    
    string, size = input().split()
    
    size = int(size)
    
    print(
        "\n".join(
            "".join(permutation) for permutation in sorted(permutations(string, size))
        )
    )
    
  • + 0 comments

    from itertools import permutations

    word, n = input().split()

    for i in sorted(permutations(word,int(n))): print(''.join(i))

  • + 0 comments

    from itertools import permutations word, n = input().split()

    for i in sorted(list(permutations(word, int(n)))): print("".join(i))

  • + 0 comments

    from itertools import permutations

    A = input().split(" ")

    if len(A) == 1: A = (list(permutations(A[0]))) else: A = (list(permutations(A[0], int(A[1]))))

    A = sorted(A)
    for i in A: print("".join(i))