The necessary ingredient in the hash map recipe is the hashing function. A hashing function takes a key and returns an index into the underlying array.
Hash functions need to be fast to compute so that access and retrieval can be done fast.
Create a method for
.hash(). This method should take two arguments:
key into a list of bytes by calling
key.encode(). Save this into a variable called
.encode() is a string method that converts a string into its corresponding bytes, a list-like object with the numerical representation of each character in the string.
Turn the bytes object into a hash code by calling
key_bytes. Save the result from that into a variable called