[Python] 순열, 조합, 곱집합
순열(permutation) 순서를 정해 나열한 경우의 수 itertools.permutations을 이용 permutations(arr, n) 에서 n개의 원소를 골라 순서를 정해 나열한다는 뜻 import itertools a = ['a','b','c'] b = [1,2,3] print(list(itertools.permutations(a))) # [('a', 'b', 'c'), ('a', 'c', 'b'), ('b', 'a', 'c'), ('b', 'c', 'a'), ('c', 'a', 'b'), ('c', 'b', 'a')] print(list(itertools.permutations(b, 2))) # [(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)] 조합(c..