Skip to content
Built-in Functions

hash()

Return an integer hash value for a hashable object.

hash(object)

hash() returns a number Python uses to organize hashable values in sets and dictionaries. Equal hashable values should have the same hash within one run.

Parameters

NameDescription
objectA hashable object, such as an integer, string, or tuple of hashable values.

Returns

An integer hash value.

Try it

Run it and change it
number = 42
print(hash(number))

Related entries