it is important to notice the difference between the size and count of table size of table refers to the total number of slots in the table (used or unusedcount of the tableon the other handsimply refers to the number of slots that are filledor put another waythe number of actual key-value pairs we have added to the table nowwe are going to add our hashing function to the table it will be similar to what we evolved in the section on hashing functionsbut with slight differencewe need to ensure that our hashing function returns value between and (the size of the tablea good way of doing so is to return the remainder of dividing the hash by the size of the tablesince the remainder is always going to be an integer value between and as the hashing function is only meant to be used internally by the classwe put an underscore(_at the beginning of the name to indicate this this is normal python convention for indicating that something is meant for internal usedef _hash(selfkey)mult hv for ch in keyhv +mult ord(chmult + return hv self size for the time beingwe are going to assume that keys are strings we shall discuss how one can use non-string keys later for nowjust bear in mind that the _hash(function is going to generate the hash value of string putting elements we add elements to the hash with the put(function and retrieve with the get(function firstwe will look at the implementation of the put(function we start by embedding the key and the value into the hashitem class and computing the hash of the keydef put(selfkeyvalue)item hashitem(keyvalueh self _hash(keynow we need to find an empty slot we start at the slot that corresponds to the hash value of the key if that slot is emptywe insert our item there