We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3605e2a commit 4d960ddCopy full SHA for 4d960dd
programmers/Lv.1/failure_percent.py
@@ -1,11 +1,10 @@
1
def solution(N, stages):
2
- stage_people = {}
+ stage_score = [0] * (N + 2)
3
for stage in stages:
4
- if stage in stage_people:
5
- stage_people[stage] += 1
6
- else:
7
- stage_people[stage] = 1
+ stage_score[stage] += 1
+ stage_failure = []
+ for i in range(1, N + 2):
+ stage_failure.append(stage_score[i] / sum(stage_score[i:N + 2]))
8
+ print(stage_failure)
9
answer = []
- for stage in list(stage_people.keys()):
10
- # 여기서 정렬하려면 list의 sort가 나아보인다.
11
return answer
0 commit comments