#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목[re][re]Step_14 dictionary 멤버 갯수 unhashable type: 'list'2020-05-12 16:20
작성자

그러면 튜플로는 어떻게 바꿔야할까요?

dictionary2 = {'red': [1,2], 'green': 1, 'blue': 2}


def count_value(dictionary):

    num=set()

    for i in dictionary:

        a=tuple(dictionary[i])

        num.add(a)

    count=len(num)

    return count


print(count_value(dictionary2))


int' object is not iterable 에러가 뜹니다. 

value를 리스트에 담고 그 리스트를 튜플로 변환해야하나요?

댓글
이전[re]Step_14 dictionary 멤버 갯수 unhashable type: 'list'2020-05-12
다음step 13 질문2020-05-12