Combination(조합) & Permutation(순열)

dobyming·2022년 12월 28일
0

Combination

: 어떤 쌍(pair)를 return 하고 싶을때 combination을 활용하면 쉽게 구할 수 있다.

즉 (A,B)와 (B,A)는 같은 것으로 취급

Syntax

from itertools import combinations
combinations('배열' , '배열 안에서 몇개의 쌍 추출할것인지')

Permutation

: (A,B)와 (B,A)는 다른 것으로 취급

Syntax

from itertools import permutations
permutations('배열' , '배열 안에서 몇개의 쌍 추출할것인지')

0개의 댓글