Skip to content

Commit 4d960dd

Browse files
authored
Update failure_percent.py with division zero error
1 parent 3605e2a commit 4d960dd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
def solution(N, stages):
2-
stage_people = {}
2+
stage_score = [0] * (N + 2)
33
for stage in stages:
4-
if stage in stage_people:
5-
stage_people[stage] += 1
6-
else:
7-
stage_people[stage] = 1
4+
stage_score[stage] += 1
5+
stage_failure = []
6+
for i in range(1, N + 2):
7+
stage_failure.append(stage_score[i] / sum(stage_score[i:N + 2]))
8+
print(stage_failure)
89
answer = []
9-
for stage in list(stage_people.keys()):
10-
# 여기서 정렬하려면 list의 sort가 나아보인다.
1110
return answer

0 commit comments

Comments
 (0)