itertools(2)
-
프로그래머스_소수찾기_python
https://programmers.co.kr/learn/courses/30/lessons/42839# 코딩테스트 연습 - 소수 찾기 한자리 숫자가 적힌 종이 조각이 흩어져있습니다. 흩어진 종이 조각을 붙여 소수를 몇 개 만들 수 있는지 알아내려 합니다. 각 종이 조각에 적힌 숫자가 적힌 문자열 numbers가 주어졌을 때, 종이 programmers.co.kr 각 종이 조각에 적힌 숫자가 적힌 문자열 numbers가 주어졌을 때, 종이 조각으로 만들 수 있는 소수가 몇 개인지 return 하도록 solution 함수를 완성해주세요. import itertools as it def solution(numbers): answer = 0 only = set([]) for num in range(1,len(n..
2021.08.08 -
python) itertools
https://docs.python.org/ko/3/library/itertools.html itertools — 효율적인 루핑을 위한 이터레이터를 만드는 함수 — Python 3.9.6 문서 docs.python.org 반복되는 데이터를 처리하는 기능 import itertools product('ABCD', repeat=2) - 순서o, 중복o AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD permutations('ABCD', 2) -순서o, 중복x AB AC AD BA BC BD CA CB CD DA DB DC combinations('ABCD', 2) -순서x, 중복x AB AC AD BC BD CD combinations_with_replacement('A..
2021.08.08