Development/Algorism

[Programmers] 로또의 최고 순위와 최저 순위

Go0G 2021. 9. 2. 17:38

문제 URL

def solution(lottos, win_nums):
    lot_dic = {6:1,5:2,4:3,3:4,2:5,1:6,0:6} #Dictionary 선언
    cont_0 = [(i) for i in lottos if i==0] #for내 If문으로 변수 초기화
    accord = 0
    answer = []
    for i in lottos:
        if i in win_nums:
            accord +=1
    answer.append(lot_dic[accord+len(cont_0)])
    answer.append(lot_dic[accord])
    
    return answer