[프로그래머스] 로또의 최고 순위와 최저 순위(파이썬)
나의 답 : def solution(lottos, win_nums): minlotto=7 maxlotto=6 for i in lottos: if i in win_nums: minlotto-=1 maxlotto=minlotto-lottos.count(0) if minlotto==7: minlotto=6 if maxlotto==7: maxlotto=6 return [maxlotto,minlotto] 다른 사람의 답 : def solution(lottos, win_nums): rank=[6,6,5,4,3,2,1] cnt_0 = lottos.count(0) ans = 0 for x in win_nums: if x in lottos: ans += 1 return rank[cnt_0 + ans],rank[ans]