Python 순열, 조합 (permutations, combinations, product)
파이썬 기본 라이브러리 itertools를 활용해서 여러 조합을 구할 수 있다. num_list = [1,2,3,4] # 순서 상관 있을 경우 from itertools import permutations list(permutations(num_list,2)) list(permutations(num_list,3)) # [(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)] # [(1, 2, 3), (1, 2, 4), (1, 3, 2), (1, 3, 4), (1, 4, 2), (1, 4, 3), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4), (2, 4, 1)..
2021. 9. 27.