Log in from a computer to take this course

You'll need to log in from a computer to start Learn Complex Data Structures. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

A data structure that is unable to contain data is a sad sight indeed. We need to put together all the other steps we’ve taken: plug the key into the hash function, plug the hash code into the compression function, use the array index to find the place in the array, and finally set the value of the array to the value we want.

Instructions

1.

Create a .assign() method for the hash map. It should take three parameters: self, key, and value.

2.

Save the value (just the value for now) to the map’s array at the index determined by plugging the key into the .hash() method and plugging the hash code into the .compressor() method.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?