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 153 views
1 answer 160 views
1 answer 170 views
1 answer 136 views
1 answer 181 views
1 answer 146 views
1 answer 86 views
...