How to create 3 letters permutation in Python

1 Answer

0 votes
import itertools

perms = itertools.permutations(['a', 'b', 'c'])

print(list(perms))


'''
run:

[('a', 'b', 'c'), ('a', 'c', 'b'), ('b', 'a', 'c'), ('b', 'c', 'a'), ('c', 'a', 'b'), ('c', 'b', 'a')]

'''

 



answered Jan 18, 2018 by avibootz

Related questions

1 answer 163 views
1 answer 168 views
1 answer 179 views
1 answer 149 views
1 answer 190 views
1 answer 156 views
1 answer 101 views
...