""" links.py A linked list in python. Run this at pythontutor.com to see what's going on. $ python links.py 1 -> 2 -> 3 -> Jim M | Feb 6 | cs.bennington.college | MIT License """ class Node: """ one node in a linked list """ def __init__(self, value, next=None): self.value = value self.next = next def print_nodes(node): """ print a list starting at a given node """ while node: print(f"{node.value} -> ", end="") node = node.next print() def main(): # Create a linked list : 1 -> 2 -> 3 three = Node(3) two = Node(2, three) one = Node(1, two) print_nodes(one) main()