We have a few zany characters to keep track of and Python nodes may do just the trick. Let’s get started…
Node, instantiate three nodes. None have an argument for
- the first has a value of
"likes to yak"and be assigned to a variable
- the second has a value of
"has a penchant for hoarding snacks"and be assigned to
- the third has a value of
"enjoys spending time in movie lots"and be assigned to
Now let’s give these nodes some responsibilities!
yacko can keep track of
dot can keep up with
wacko can’t keep track of anything though.
Below the newly created nodes, use your
.set_link_node() method to give:
Create two new variables,
wackos_data. Use both getter methods to get
dot‘s value from
yacko and get
wacko‘s value from
wackos_data to the console to see the results!
When your code is passing, take a moment to consider:
- How would you get
- How could you get from
- How do you think nodes could be helpful for keeping track of and storing information?