Skip to main content

Posts

Showing posts with the label The Crazy Programmer Solve Typeerror: unhashable type ‘list’ in Python Solve Typeerror: unhashable type ‘list’ in Python The Crazy Programmer

Solve Typeerror: unhashable type ‘list’ in Python Gorakh Gupta The Crazy Programmer

In python, there are many types of errors as once the code has many types of problems in which this error will come. Errors will always define which type of problem has occurred in the solution. In this article we will go through the Typeerror: unhashable type ‘list’ and what causes this error and how to get the solution for it from some of the programs. Let’s talk about hashable as it is a feature of python objects and this tells about hash value as if any object has hash value then we can use it as a key value in the dictionary otherwise, we can use it for addition as a set element. Example: {Key1:Value1, Key2:Value2, Key3:Value3} {setObject1, setObject2, setObject3} Now there is a problem to know which object is hashable and which object is not. The objects in python which are immutable and have a hash value are called hashable and which are mutable and don’t have a hash value are called unhashable. Immutable are those which cannot be modified as a number, string, and tuple e