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


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!

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?