본문 바로가기

Programming/Programmers

[프로그래머스/Python] 모의고사(단순구현)

def correct_counter(supoza, answers):
    cnt=0
    for i in range(len(answers)):
        if answers[i] == supoza[i%len(supoza)]: cnt+=1
    return cnt

def solution(answers):
    
    supoza1 = [1, 2, 3, 4, 5]
    supoza2 = [2, 1, 2, 3, 2, 4, 2, 5]
    supoza3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
    
    cnt=[]
    cnt.append(correct_counter(supoza1,answers))
    cnt.append(correct_counter(supoza2,answers))
    cnt.append(correct_counter(supoza3,answers))
    
    answer = []
    for i in range(len(cnt)):
        if cnt[i]==max(cnt):
            answer.append(i+1)
            
    return answer