Python doubt related to hash()

what is hash function mam?

2 Likes

It is a built-in function.
It is used to quickly compare dictionary keys while looking at a dictionary.

A hash function is a function from some sort of input to a number. In particular, a hash function takes arbitrarily sized inputs to a fixed size output. It “shrinks” the input space to a predefined output range.

There are two main uses for hash functions: data structures and security.

1 Like

@mekala.akhil2468

The key for a given object can be calculated using a function called a hash function .

For example, given an array A, if i is the key, then we can find the value by simply looking up A[i]. There are many hash functions that use numeric or alphanumeric keys.

Try below code for your reference:-