Python hash()

Configurare noua (How To)

Situatie

The hash() method returns the hash value of an object if it has one. Hash values are just integers that are used to compare dictionary keys during a dictionary look quickly.

Solutie

Pasi de urmat

print(‘Hash for 181 is:’, hash(181))

print(‘Hash for 181.23 is:’,hash(181.23))

print(‘Hash for Python is:’, hash(‘Python’))

Output:

Hash for 181 is: 181
Hash for 181.23 is: 530343892119126197
Hash for Python is: 2230730083538390373

Tip solutie

Permanent

Voteaza

(3 din 6 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?