Python TypeError: unhashable type: 'list'

preview_player
Показать описание


If you are newbie to Python, you are in the right place. At this channel, we are provide high quality videos to become a pro in Python .Our future videos are aimed at creating Beginner friendly advanced Python projects.Stay tuned,stay safe 😊.
Рекомендации по теме
Комментарии
Автор

Hashable : int, float, str, tuple, and Booleans
Unhashable : set, list and dict

-minutepython
Автор

A = set() #Empty Set

element = (5, 6, [ "Apple" ])
A.add(element)

TYPEERROR : unhashable type list.

The reason is tuple is immutable but in our case tuple element variable is not immutable.

We can access element[2] and then element[2].append("banana")
So when we are adding this the list inside tuple cannot be a hashable.

DhavalAhir