[ps] 프로그래머스 레벨1 성격 유형 검사하기

Ho Saint·2022년 8월 31일
0

problem solving

목록 보기
1/1

1. 2022 KAKAO TECH INTERNSHIP 성격 유형 검사하기

2. 처음 풀이

from collections import defaultdict

def solution(survey, choices):
    indicators = (('R', 'T'), ('C', 'F'), ('J', 'M'), ('A', 'N'))
    scores = defaultdict(int)
    type = []
    
    for s, c in zip(survey, choices):
        score = c - 4
        scores[s[0]] -= score
        scores[s[1]] += score
    
    for i in indicators:
        if scores[i[1]] > scores[i[0]]:
            type.append(i[1])
            continue
    
        type.append(i[0])
        
    return "".join(type)

3. 문제점 / 해결책

4. reference

5. 최종

6. 파이썬

  • indicators는 상수니까 tuple로
profile
열정보다 시스템. 실수를 막을 수 있는 프로세스.

0개의 댓글