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 261 views
1 answer 246 views
1 answer 224 views
1 answer 248 views
1 answer 273 views
1 answer 281 views
1 answer 291 views
...