Learn
Linked Lists: Python
Linked List Review

Congratulations, you have implemented a linked list in Python!

We did this by:

  • Defining a Node class to hold the values and links between nodes
  • Implementing a LinkedList class to handle external operations on the list like adding and removing nodes

Instructions

Feel free to play around a bit with your code. Here are some ideas:

  • Create a few nodes and adding them to a new linked list
  • Print your linked list out by using your stringify_list() method
  • Remove your linked list’s head node
  • Print your list again — was your original head node removed?
  • So far you’ve built a method to remove the first occurrence of a given value. How do you think you would remove all nodes that have a specific value? Try building a method to do that!
Folder Icon

Sign up to start coding

Already have an account?