https://programmers.co.kr/learn/courses/30/lessons/42889
def solution(N, stages):
clear = {}
stage_num = len(stages)
for n in range(1, N+1):
try:
if n != N:
clear[n] = stages.count(n) / stage_num
stage_num -= stages.count(n)
else:
clear[n] = stages.count(n) / stage_num
except:
clear[n] = 0
return sorted(clear, key=lambda x:clear[x], reverse=True)
'파이썬 코딩테스트 > 프로그래머스' 카테고리의 다른 글
프로그래머스 / 예산 / 파이썬 (0) | 2022.03.02 |
---|---|
프로그래머스 / 약수의 개수와 덧셈 / 파이썬 (0) | 2022.02.27 |
프로그래머스 / 폰켓몬 / 파이썬 (0) | 2022.02.25 |
프로그래머스 / 소수 만들기 / 파이썬 (0) | 2022.02.25 |
프로그래머스 / 내적 / 파이썬 (0) | 2022.02.25 |