Skip to content

Commit f2dad88

Browse files
authored
Add files via upload
1 parent f485564 commit f2dad88

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

LEVEL2/Day2/fail.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def solution(N, stages):
2+
answer = []
3+
_len = len(stages)
4+
_num = 0
5+
6+
for x in range(1, N+1):
7+
for y in stages:
8+
if x==y:
9+
_num+=1
10+
if _num > 0:
11+
answer.append(_num/_len)
12+
_len = _len - _num
13+
_num = 0
14+
else:
15+
answer.append(0)
16+
answer = sorted(range(len(answer)), key=lambda k : answer[k], reverse=True)
17+
answer = [x+1 for x in answer]
18+
return answer

LEVEL2/Day2/lotto.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from collections import Counter
2+
3+
def solution(lottos, win_nums):
4+
lotto = {6:1, 5:2, 4:3, 3:4, 2:5, 1:6, 0:6}
5+
6+
c = Counter(lottos) - Counter(win_nums)
7+
cnt = 6 - sum([v for k, v in c.items()])
8+
return [lotto[cnt+c[0]], lotto[cnt]]

0 commit comments

Comments
 (0)