문제 링크 : https://programmers.co.kr/learn/courses/30/lessons/77484
def ranking(cnt): if cnt == 6: return 1 elif cnt == 5: return 2 elif cnt == 4: return 3 elif cnt == 3: return 4 elif cnt == 2: return 5 else: return 6
def cmp(lottos, win_nums): answer = [] cnt = 0 zeros = 0 for i in lottos: if i == 0: zeros += 1 elif i in win_nums: cnt += 1
answer.append(ranking(cnt+zeros)) answer.append(ranking(cnt))
return answer
def solution(lottos, win_nums): answer = cmp(lottos, win_nums)
return answer
|