We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Insert

Now that we have some building blocks for our hashmap, we need a way to start inserting values.

Assignment

Complete the insert method. It accepts a string key and an associated value (in this case, LockedIn user records).

  1. Convert the incoming key to the appropriate storage index using your existing hash function
  2. Create a key-value pair as a tuple
  3. Store the tuple at the calculated index in the underlying array

The resulting structure should look something like this, with key-value pairs at some positions and empty slots at others:

[
    (key, val),
    None,
    None,
    (key, val),
    None,
    ...
]

Indexes with an entry will contain a tuple, and empty indexes will contain the None value.