https://school.programmers.co.kr/learn/courses/30/lessons/118666
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(survey, choices):
result = ''
cnt = {"R": 0, "T": 0,
"C": 0, "F": 0,
"J": 0, "M": 0,
"A": 0, "N": 0}
for standard, score in zip(survey, choices):
if score < 4:
cnt[standard[0]] += (4 - score % 4)
elif score > 4:
cnt[standard[1]] += score % 4
else:
continue
if cnt['R'] >= cnt['T']:
result += 'R'
else:
result += 'T'
if cnt['C'] >= cnt['F']:
result += 'C'
else:
result += 'F'
if cnt['J'] >= cnt['M']:
result += 'J'
else:
result += 'M'
if cnt['A'] >= cnt['N']:
result += 'A'
else:
result += 'N'
return result
728x90
반응형
'🔻PS > Programmers' 카테고리의 다른 글
[Programmers] 프로그래머스 소수 찾기 Python (0) | 2024.05.06 |
---|---|
[Programmers] 프로그래머스 부족한 금액 계산하기 Python (0) | 2024.05.06 |
[Programmers] 프로그래머스 k번째수 Python (0) | 2024.05.04 |
[Programmers] 프로그래머스 가장 먼 노드 Python (0) | 2024.05.03 |
[Programmers] 프로그래머스 개미군단 Python (2) | 2024.03.24 |