Python Program to Compute all the Permutation of the String (Using itertools)

bookmark

from itertools import permutations

words = [''.join(p) for p in permutations('pro')]

print(words)

 

Output

['pro', 'por', 'rpo', 'rop', 'opr', 'orp']