hash(object)
Returns the hash of a specified object.
Parameters
The hash() function takes one parameter:
object- the object whose hash value is returned (integer, string, floating-point number)
Return Value
- The
hash()function returns the hash value of the object.
Examples
# Hash for integer remains unchanged
print('Hash for 162 is:', hash(162))
# Hash for floating-point number
print('Hash for 191.45 is:', hash(191.45))
# Hash for string
print('Hash for Python is:', hash('Python'))
# Result:
# Hash for 162 is: 162
# Hash for 191.45 is: 1037629354146136255
# Hash for Python is: -2580035511806386587