취준시절/프로그래머스

[프로그래머스] 위장 - Python

MAYMIN 2021. 8. 11. 22:29
728x90
SMALL

그새 또 까먹은 { }......................ㅠ 😥

복습 필수다 !!!!!!!!!!!!!!!!!!!!

def solution(clothes):
    answer = {}
    for i in clothes:
        clotes_type = i[1]
        if clotes_type in answer:
            answer[clotes_type] += 1
        else:
            answer[clotes_type] = 1
    result = 1
    for i in answer.values():
        result *=(i+1)
    result-=1
    return result
728x90
LIST