We have a few zany characters to keep track of and Python nodes may do just the trick. Let’s get started…



Outside of Node, instantiate three nodes. None have an argument for link_node:

  • the first has a value of "likes to yak" and be assigned to a variable yacko
  • the second has a value of "has a penchant for hoarding snacks" and be assigned to wacko
  • the third has a value of "enjoys spending time in movie lots" and be assigned to dot

Now let’s give these nodes some responsibilities! yacko can keep track of dot and dot can keep up with wacko. wacko can’t keep track of anything though.

Below the newly created nodes, use your .set_link_node() method to give:

  • yacko a link_node of dot
  • dot a link_node of wacko

Create two new variables, dots_data, and wackos_data. Use both getter methods to get dot‘s value from yacko and get wacko‘s value from dot. Print dots_data and wackos_data to the console to see the results!

When your code is passing, take a moment to consider:

  • How would you get yacko‘s value?
  • How could you get from yacko to wacko‘s value?
  • How do you think nodes could be helpful for keeping track of and storing information?

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?