itertools.permutations()

Sort by

recency

|

956 Discussions

|

  • + 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))

  • + 0 comments
    from itertools import permutations
    s, k = input().split()
    s = s.upper()
    
    for i in sorted(permutations(s, int(k))):
        list_permu = "".join(i)
        print(list_permu)