I tried to solve the combination problem in Python, but I can't think of a good way. .. ..
letter = ["A","B","C"]
for i in range(3):
for j in range(3):
for k in range(3):
print letter[i], letter[j], letter[k]
This is too childish, and the length of the list increases. .. ..
So, when I looked it up, there was a useful library.
import itertools
letter = ["A","B","C"]
for i in itertools.product(letter, repeat=len(letter)):
print i
This only took a few lines.
Recommended Posts