로또의 최고 순위와 최저 순위 (1) 썸네일형 리스트형 [ 프로그래머스 ] 로또의 최고 순위와 최저 순위 / 제출 1 / def score(num): if num == 6: return 1 elif num == 5: return 2 elif num == 4: return 3 elif num == 3: return 4 elif num == 2: return 5 else: return 6 def solution(lottos, win_nums): lotto_cnt = 0 # 1. lottos에서 win_nums에 속해있는 것을 골라낸다. for lotto_num in lottos: if lotto_num in win_nums: lotto_cnt += 1 # 2. lottos에서 0의 개수를 찾는다. zero_cnt = lottos.count(0) # 3. 최고순위 찾는 경우: 0의 개수만큼 더하기 best = l.. 이전 1 다음