반응형
https://school.programmers.co.kr/learn/courses/30/lessons/118666
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(survey, choices):
dic = {'R':0, 'T':0, 'C':0, 'F':0, 'J':0, 'M':0, 'A':0, 'N':0}
for i in range (len(choices)):
if choices[i] == 1:
dic[survey[i][0]] += 3
if choices[i] == 2:
dic[survey[i][0]] += 2
if choices[i] == 3:
dic[survey[i][0]] += 1
if choices[i] == 5:
dic[survey[i][1]] += 1
if choices[i] == 6:
dic[survey[i][1]] += 2
if choices[i] == 7:
dic[survey[i][1]] += 3
answer = ''
if dic['R'] >= dic['T']:
answer+='R'
else:
answer+='T'
if dic['C'] >= dic['F']:
answer+='C'
else:
answer+='F'
if dic['J'] >= dic['M']:
answer+='J'
else:
answer+='M'
if dic['A'] >= dic['N']:
answer+='A'
else:
answer+='N'
return answer
반응형
'코딩테스트 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] lv.1 핸드폰 번호 가리기 python (0) | 2023.07.03 |
---|---|
[프로그래머스] lv.1 음양 더하기 python (0) | 2023.07.03 |
[프로그래머스] lv.2 가장 큰 정사각형 python (1) | 2023.04.28 |
[프로그래머스] lv.1 달리기 경주 python (0) | 2023.04.28 |
[프로그래머스] lv.2 3 x n 타일링 python (1) | 2023.04.17 |