from itertools import permutations
def solution(numbers):
num_list = []
for i in range(1, len(numbers)+1):
test_list = permutations(numbers, i)
for j in test_list:
num_list.append(int("".join(j)))
num_list = set(num_list)
if 0 in num_list:
num_list.remove(0)
if 1 in num_list:
num_list.remove(1)
answer = len(num_list)
for i in num_list:
if i != 2:
for j in range(2, int(i**0.5)+1):
if i % j == 0:
answer -=1
break
return answer
'Language > Python' 카테고리의 다른 글
[Python / 프로그래머스 level 2] 올바른 괄호 (0) | 2021.08.20 |
---|---|
[Python / 프로그래머스 level 2] 124 나라의 숫자 (0) | 2021.08.19 |
[Python / 프로그래머스 level 2] 전화번호 목록 (0) | 2021.08.17 |
[Python / 프로그래머스 level 2] 위장 (0) | 2021.08.16 |
[Python / 프로그래머스 level 2] 기능개발 (0) | 2021.08.13 |