Python 순열/조합/중복순열/중복조합 구하기
1. 순열 from itertools import permutations for i in permutations([1,2,3,4], 2): print(i, end=" ") 결과 (1, 2) (1, 3) (1, 4) (2, 1) (2, 3) (2, 4) (3, 1) (3, 2) (3, 4) (4, 1) (4, 2) (4, 3) 2. 조합 from itertools import combinations for i in combinations([1,2,3,4], 2): print(i, end=" ") 결과 (1, 2) (1, 3) (1, 4) (2, 3) (2, 4) (3, 4) 3. 중복순열 from itertools import product for i in product([1,2,3],'ab'): prin..
2021. 1. 27.