itertools.permutations()

  • + 0 comments

    from itertools import permutations

    def permut(s, k): s.upper() p_val = list(permutations(s, k)) p_val.sort() [print(''.join(x)) for x in p_val]

    space_sep_input = input().split() string = (space_sep_input[0]).upper() k = int(space_sep_input[1]) permut(string, k)