How do generate permutations of a given word? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do generate permutations of a given word?

I want to make list of words based on permutation of a given word.

24th Mar 2018, 12:59 PM
Brian Tomas
Brian Tomas - avatar
1 Answer
+ 3
word = input() from itertools import permutations lst =[x for x in permutations (word)] Use permutations function from itertools module.
24th Mar 2018, 1:32 PM
Vivek Sivaramakrishnan
Vivek Sivaramakrishnan - avatar