

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Hashmaps
incomplete
2: Hash Function
incomplete
3: Insert
incomplete
4: Get
incomplete
5: Hash Map Review
incomplete
6: Resizing
incomplete
7: Linear Probing
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Now that we can insert our users and their records into our hashmap, we need a way to retrieve that information when requested!
Complete the get method. It takes a key (a string) and returns the value stored at that location (not the whole key/value tuple).
Use the key_to_index method to find the correct index to look up in the self.hashmap datastore, and if a value doesn't exist at that index, raise the following Exception to indicate no key was found.
raise Exception("sorry, key not found")
Due to our simple implementation, some of the keys that are inserted into the hashmap will have colliding values, which may lead to strange results - that's okay!