プログラマー-模擬試験
未熟な問題解は正解にはならず,もちろんこれよりも有効なコードがある.
参考までに、いつでもご返事をお待ちしております.🤍
参考までに、いつでもご返事をお待ちしております.🤍
def solution(answers):
qnum=int(len(answers)/5)+1
score={1:0,2:0,3:0}
supo1 = [1,2,3,4,5]*qnum
supo2 = [2, 1, 2, 3, 2, 4, 2, 5]*qnum
supo3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]*qnum
for i in range (0,len(answers)):
if answers[i]==supo1[i]:
score[1]=score[1]+1
if answers[i]==supo2[i]:
score[2]=score[2]+1
if answers[i]==supo3[i]:
score[3]=score[3]+1
answer = sorted([k for k,v in score.items() if max(score.values()) == v])
return answer
Reference
この問題について(プログラマー-模擬試験), 我々は、より多くの情報をここで見つけました https://velog.io/@yujiniii/프로그래머스-모의고사テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol