Python hash() Function
Returns the hash value of the specified value if it has one. Numbers do not have a hash value other than the number itself. Hash values are used to improve the performance of key lookups, for example in a dictionary.
Syntax
Python
Copy Code
hash(object)
Parameters
Parameter | Description |
---|---|
object |
Required. The object for which the hash should be generated. |
Example
Python
Copy Code
print(hash(1)) print(hash('Hello World'))
Output
1 -7449866412269572252