[알고리즘] itertools 라이브러리
1. 순열(Permutation) 순서는 있으나 중복 없는 모든 경우의 수를 나열합니다. 2는 dataset에서 2개를 뽑아 리스트를 만들어주는 역할을 합니다. dataset = ['A', 'B', 'C'] printList = list(permutations(dataset, 2)) print(printList) # 결과값 # [('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')] dataset = ['A', 'B', 'C'] printList = list(permutations(dataset, 3)) print(printList) # 결과값 # [('A', 'B', 'C'), ('A', 'C', 'B'), ('B', 'A', '..
2023. 1. 25.