Permutations
순열, 줄세우는 여러가지 경우의 수
from itertools import permutations
items = [1, 2, 3]
perms = permutations(items, 2)
print(list(perms)) # [(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]
Combinations
조합, 주머니에서 n개를 뽑아서 나오는 모든 경우의수
from itertools import combinations
items = [1, 2, 3]
combs = combinations(items, 2)
print(list(combs)) # [(1, 2), (1, 3), (2, 3)]
Product
곱집합
from itertools import product
a = [1, 2, 3]
b = [4, 5, 6]
c = ['a', 'b']
pds = product(a, b, c)
print(list(pds))
# [(1, 4, 'a'), (1, 4, 'b'), (1, 5, 'a'), (1, 5, 'b'), (1, 6, 'a'), (1, 6, 'b'), (2, 4, 'a'), (2, 4, 'b'), (2, 5, 'a'), (2, 5, 'b'), (2, 6, 'a'), (2, 6, 'b'), (3, 4, 'a'), (3, 4, 'b'),
# (3, 5, 'a'), (3, 5, 'b'), (3, 6, 'a'), (3, 6, 'b')]