How do generate permutations of a given word? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponse
+ 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