def solution(clothes):
answer = 0
cloths = {}
for name,clothtype in clothes:
if clothtype in cloths:
cloths[clothtype] += 1
else:
cloths[clothtype] = 1
answer = 1
for key, value in cloths.items():
#각 아이템의 개수를 한 개씩 뽑아오기.
answer *= (value + 1)
#해당 아이템을 착용하지 않을 경우를 고려해서 +1
return answer - 1
#모두 입지 않은 경우를 고려해서 -1
'문제풀이 > 프로그래머스' 카테고리의 다른 글
[프로그래머스][Lv1] - 신규 아이디 추천(Python) (0) | 2021.10.12 |
---|---|
[프로그래머스] - 약수의 개수와 덧셈(Python) (0) | 2021.10.07 |
[프로그래머스] - 같은 숫자는 싫어(Python) (0) | 2021.10.07 |
[프로그래머스][해시] - 전화번호 목록(Python) (0) | 2021.10.06 |
[프로그래머스][해시] - 완주하지 못한 선수(Python) (0) | 2021.10.06 |