순위를 배열에 정리하고 최대로 맞췄을 경우와 최소로 맞췄을 경우를 배열에 넣는다. def solution(lottos, win_nums): answer = [] Back = [6,6,5,4,3,2,1] #6등부터 1등까지 a=set(win_nums)-set(lottos) #동일한 번호를 빼줌 l = 6-len(a) #몇 개 번호가 일치하는지 x =l+lottos.count(0) #최대 당첨 if x>6: #6등일 때 x=6 m=Back[x] #최대 n=Back[l] #최소 answer.append(m) answer.append(n) return answer