Accessing Values in Dictionary
Accessing Values in Dictionary
Accessing Values in Dictionary
Hash tables are a type of data structure in which the address or the index
value of the data element is generated from a hash function. That makes
accessing the data faster as the index value behaves as a key for the data
value. In other words Hash table stores key-value pairs but the key is
generated through a hashing function.
The keys of the dictionary are hashable i.e. the are generated by hashing
function which generates unique result for each unique value supplied to the
hash function.
# Declare a dictionary
# Declare a dictionary
This produces the following result. Note that an exception is raised because
after del dict dictionary does not exist anymore −
dict['Age']:
Traceback (most recent call last):
File "test.py", line 8, in
print "dict['Age']: ", dict['Age'];
TypeError: 'type' object is unsubscriptable
Assignment
https://runestone.academy/runestone/books/published/pythonds/SortSearch/Hashing.html
https://www.ibrahimgabr.com/blog/2017/12/17/python-hashing-and-hash-tables