L1 : 모의고사 Python

jhyunn·2023년 1월 19일
0

Programmers

목록 보기
36/69

L1 : 모의고사 Python

https://school.programmers.co.kr/learn/courses/30/lessons/42840

import numpy as np
def solution(answers):
    answer = []
    s1 = [1, 2, 3, 4, 5]
    s2 = [2, 1, 2, 3, 2, 4, 2, 5]
    s3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]

    for s in [s1, s2, s3]:
        answer.append([a==s[i%len(s)] for i, a in enumerate(answers)].count(True))
    if answer.count(max(answer)) > 0:
        return (np.where(np.array(answer)==max(answer))[0]+1).tolist()

#numpy #where

profile
https://github.com/Sungjeonghyun

0개의 댓글