문제링크: 성격 유형 검사하기
✍🏻 Information
| content | |
|---|---|
| 언어 | python |
| 난이도 | ⭐️ |
| 풀이시간 | 15분 |
| 제출횟수 | 2 |
| 인터넷검색유무 | yes |
🍒 My Code
def solution(survey, choices):
answer = ''
score = {'R':0,'T':0,'C':0,'F':0,'J':0,'M':0,'A':0,'N':0}
for i in range(len(survey)):
nowscore = choices[i]-4
if nowscore < 0: #비동의쪽
score[survey[i][0]]+=abs(nowscore)
elif nowscore > 0: #동의쪽
score[survey[i][1]]+=nowscore
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
💡 What I learned