하얀이 코딩 블로그

  • 홈
  • 태그
  • 방명록

Algorithm/Python 12

Python - 중복 순열, 중복 조합

1) 중복 순열 - product from itertools import product data = ['a', 'b', 'c'] result = list(product(data, repeat=2)) # 중복을 허용하여 2개를 뽑는 모든 순열 print(result) 2) 중복 조합 - combinations_with_replacement from itertools import combinations_with_replacement data = ['a', 'b', 'c'] result = list(combinations_with_replacement(data, 2)) # 중복을 허용하여 2개를 뽑는 모든 조합 print(result) 참고: 이코테 2021 강의 동영상

Algorithm/Python 2022.02.04

Python - 순열과 조합

1) 순열 서로 다른 n개에서 서로 다른 r개를 선택하여 일렬로 나열하는 것 {'a', 'b', 'c'}에서 세 개를 선택하여 나열하는 경우, permutations 사용 from itertools import permutations data = ['a', 'b', 'c'] result = list(permutations(data, 3)) print(result) 실행결과 [('a','b','c'), ('a','c','b'), ('b','a','c'), ('b','c','a'), ('c','a','b'), ('c','b','a')] 2) 조합 서로 다른 n개에서 순서에 상관없이 서로 다른 r개를 선택하는 것 {'a', 'b', 'c'}에서 순서를 고려않고 두 개를 뽑는 경우, combinations 사용..

Algorithm/Python 2022.02.04
1 2
더보기
프로필사진

  • 분류 전체보기 (54)
    • Frontend (9)
      • html, css (9)
      • javascript (0)
    • Backend (23)
      • MongoDB (5)
      • Flask (8)
      • Node.js (10)
    • Algorithm (20)
      • Python (12)
      • programmers (6)
      • BOJ 단계별로 풀어보기 (2)
    • AI (0)
      • Deep Learning (0)
    • Git (0)
    • Project (2)
      • 데이터 분석 웹 서비스 프로젝트 (2)

Tag

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/12   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바