본문 바로가기 메뉴 바로가기

Good Developer

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Good Developer

검색하기 폼
  • 분류 전체보기 (76)
    • hhplus (6)
    • 개발서적 (4)
    • Error (2)
    • Kafka (1)
    • React (3)
    • Docker (5)
    • Spring (6)
    • Java (27)
    • Project (3)
    • Python (16)
    • DB (3)
    • Github (0)
  • 방명록

permutations (1)
[Python] permutations

순열(Permutation)에 대해 간략하게 알아보도록 하겠습니다. 순열은 서로 다른 n개의 물건들 중 r개를 뽑아 순서가 있게 나열한 것이며 기호로 nPr와 같이 나타내고 중복은 가능합니다. nPr의 팩토리얼을 이용한 계산 n!/(n-r)!입니다.4개의 물건 중에 2개를 뽑은 경우의 수는 12입니다.nPr = 4!/(4-2)! 즉 4 x 3 x 2 x 1 / 2 x 1로 24 / 2 = 12* 0! 은 1입니다. 1. 아래 코드 블록 itertools 라이브러리를 사용하여 작성한 코드입니다.from itertools import permutationstest_list = ['A', 'B', 'C', 'D']result = list(permutations(test_list, 2))print(result)..

Python 2022. 12. 7. 10:12
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Method
  • Lambda
  • function
  • operators
  • combinations
  • bool
  • zip
  • If
  • isdigit
  • isalpha
  • Python
  • index
  • counter
  • Lower
  • permutations
  • Upper
  • Built-in Functions
  • find
  • for
more
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바