2022 KAKAO TECH INTERNSHIP - 118666. 성격 유형 검사하기
[Lv. 1]
https://school.programmers.co.kr/learn/courses/30/lessons/118666
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
풀이
문제에서 요구하는 대로 구현하면 되는 간단한 문제.
score = {i:0 for i in ["R", "T", "C", "F", "J", "M", "A", "N"]}
def scoring(survey, choice):
if choice == 4:
return
elif choice > 4:
score[survey[1]] += choice-4
else:
score[survey[0]] += 4-choice
def solution(survey, choices):
answer = ''
# scoring with choices
for i in range(len(choices)):
scoring(survey[i], choices[i])
# select type that has higher score
if score["R"] >= score["T"]:
answer += "R"
else:
answer += "T"
if score["C"] >= score["F"]:
answer += "C"
else:
answer += "F"
if score["J"] >= score["M"]:
answer += "J"
else:
answer += "M"
if score["A"] >= score["N"]:
answer += "A"
else:
answer += "N"
return answer