-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgrammers_Lv2_23.py
More file actions
37 lines (30 loc) · 868 Bytes
/
Programmers_Lv2_23.py
File metadata and controls
37 lines (30 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# def get_zero(lottos):
# count = 0
# for num in lottos:
# if num == 0 :
# count += 1
# return count
# def solution(lottos, win_nums):
# answer = [0] * 2
# check_nums = [0] * 2
# rank = [6,5,4,3,2]
# zero_cnt = get_zero(lottos)
# for num in lottos:
# if num in win_nums:
# check_nums[0] += 1
# check_nums[1] += 1
# check_nums[0] += zero_cnt
# for i in range(len(check_nums)):
# try:
# answer[i] = rank.index(check_nums[i]) + 1
# except:
# answer[i] = 6
# return answer
def solution(lottos, win_nums):
answer = 0
zero_cnt = lottos.count(0)
rank = [6,6,5,4,3,2,1]
for num in lottos:
if num in win_nums:
answer += 1
return rank[zero_cnt + answer], rank[answer]