How to create permutation of 3 letters based on string in Python

1 Answer

0 votes
from itertools import permutations 
  
s = "abc"
  
permutation = [''.join(e) for e in permutations(s)] 

print(permutation)

         
  
  
'''
run:

['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
          
'''
 

 



answered May 12, 2020 by avibootz

Related questions

1 answer 160 views
1 answer 170 views
1 answer 136 views
1 answer 157 views
1 answer 185 views
1 answer 180 views
1 answer 202 views
...