💻 하나씩 차곡차곡/프로그래머스 (Python)
[프로그래머스/Lv.1/Python] 모의고사
뚜루리
2024. 1. 26. 13:46
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