[Programmers] - 로또의 최고 순위와 최저 순위 (Level 1)


2021 Dev-Matching: 웹 백엔드 개발
LEVEL : 1

문제 링크

def solution(lottos, win_nums):

    windict = {6:1, 5:2, 4:3, 3:4, 2:5, 1:6, 0:6}
    lowest = len(set(lottos).intersection(set(win_nums)))
    highest = lowest + len([x for x in lottos if x==0])

    answer = [windict[highest], windict[lowest]]
    return answer
lottos = [44, 1, 0, 0, 31, 25]
win_nums = [31, 10, 45, 1, 6, 19]
solution(lottos, win_nums)
[3, 5]

Comments