728x90
320x100
def solution(answers):
answer = []
supoja1 = [1, 2, 3, 4, 5]
supoja2 = [2, 1, 2, 3, 2, 4, 2, 5]
supoja3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
score = [0, 0, 0]
for idx, value in enumerate(answers) :
if value == supoja1[idx % len(supoja1)]:
score[0] += 1
if value == supoja2[idx % len(supoja2)]:
score[1] += 1
if value == supoja3[idx % len(supoja3)]:
score[2] += 1
for idx, s in enumerate(score):
if s == max(score):
answer.append(idx+1)
return answer
728x90
320x100
'💻 하나씩 차곡차곡 > 프로그래머스 (Python)' 카테고리의 다른 글
[프로그래머스/Lv.2/파이썬] H-Index (0) | 2024.10.16 |
---|---|
[프로그래머스/Lv.2/Python] 가장 큰 수 (0) | 2024.01.25 |
[프로그래머스/Lv.1/Pyhton] K번째수 (0) | 2024.01.24 |
[프로그래머스/Lv2/Python] 큰 수 만들기 (0) | 2024.01.23 |
[프로그래머스/Lv2/Python] 구명보트 (0) | 2024.01.22 |