all possible combinations

rbt rbt at athop1.ath.vt.edu
Wed Jul 13 10:21:19 EDT 2005


Say I have a list that has 3 letters in it:

['a', 'b', 'c']

I want to print all the possible 4 digit combinations of those 3
letters:

4^3 = 64

aaaa
abaa
aaba
aaab
acaa
aaca
aaac
...

What is the most efficient way to do this? 



More information about the Python-list mailing list