프로그래머스 - 로또의 최고 순위와 최저 순위
문제집 링크 : http://aladin.kr/p/szPra
프로그래머스 URL :
■ 작성 코드
def solution(lottos, win_nums):
win_cnt = 0
lose_cnt = 0
for l in lottos:
if l in win_nums:
win_cnt +=1
elif l == 0:
lose_cnt +=1
rank_list = [6, 6, 5, 4, 3, 2, 1]
answer = [rank_list[win_cnt+lose_cnt], rank_list[win_cnt]]
return answer
반응형
'Programming Test > 문제풀이' 카테고리의 다른 글
[프로그래머스] 17. 2차원으로 만들기 - Python (0) | 2025.01.23 |
---|---|
[프로그래머스] 16. 잘라서 배열로 저장하기 - Python (0) | 2025.01.23 |
[프로그래머스] 14. 카드뭉치 - Python (0) | 2025.01.21 |
[프로그래머스] 13. 369 게임 - Python (0) | 2025.01.21 |
[프로그래머스] 12. 치킨 쿠폰 - Python (0) | 2025.01.20 |