itertools.permutations()

Sort by

recency

|

904 Discussions

|

  • + 0 comments
    from itertools import permutations
    s, n = input().split(" ")
    [ print(''.join(x)) for  x in sorted(permutations(s,int(n)))]  
    
  • + 0 comments
    from itertools import permutations
    
    # Input the string and integer k
    input_data = input().split()
    S = input_data[0]
    k = int(input_data[1])
    
    # Generate and sort permutations
    result = permutations(sorted(S), k)
    
    # Print each permutation
    for perm in result:
        print(''.join(perm))
    
  • + 0 comments

    from itertools import permutations

    s = input().split() x = s[0] y = int(s[1]) sorted_s = sorted(x)

    for i in range(1,y+1): # for j in permutations(sorted_s,i): # for j in range(len(sorted_s)): # for j in permutations(sorted_s): for j in permutations(sorted_s,i+1): if i>=2: continue print(''.join(j))

  • + 0 comments
    import sys
    from itertools import permutations
    
    for line in sys.stdin.readlines():
        m, n = line.split()
        
    str = sorted(permutations(m, int(n)))
    for i in str:
        print(''.join(i))
    
  • + 0 comments

    from itertools import permutations def permutation(): user_input = input() input_list = user_input.split() var1, var2 = input_list[0], int(input_list[1]) k = list(permutations(var1, var2)) new_list = ["".join(i) for i in k] for element in sorted(new_list): print(element) if name == "main": permutation()