Python How To Fix TypeError: unhashable type: 'list' (Troubleshooting #2)

preview_player
Показать описание
My first troubleshooting video was well received. It looks like there's an appetite for video like these. So as I continue to build my own digital assistant like Jarvis from the Iron Man movies and comics, I'll keep publishing videos on how to fix problems I experience.

This video is how to fix TypeError: unhashable type: 'list' and could also be useful to those trying to fix TypeError: unhashable type: 'dict', both in Python.

Рекомендации по теме
Комментарии
Автор

Thanks a million for the shout out, I'll link back to this video, from my website. Just watched your video, great explanation 👍 👍

DataAnalyticsIreland
Автор

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