def count_rank_matching(count):
if count == 6:
rank = 1
elif count == 5:
rank = 2
elif count == 4:
rank = 3
elif count == 3:
rank = 4
elif count == 2:
rank = 5
else:
rank = 6
return rank
def solution(lottos, win_nums):
answer = []
zero = 0
for num in lottos:
if num == 0:
zero+=1
count = len(list(set(win_nums).intersection(lottos)))
min_count = count
max_count = count+ zero
answer=[count_rank_matching(max_count),count_rank_matching(min_count)]
return answer
문제 풀이 (Python 코드)
728x90
반응형