  
  class LinkedList(object):
      def __init__(self, head):
          self.head = head
  
      def __len__(self):
          curr = self.head
          counter = 0
          while curr is not None:
              counter += 1
              curr = curr.next
          return counter
      
      def insert_to_front(self, data):
          if data is None:
              return
          node = Node(data)
 
</s> remove     def __init__(self, head):
 </s> add     def __init__(self, head=None): </s> remove         node = Node(data)
 </s> add         node = Node(data, next_node) </s> remove     def append(self, data):
 </s> add     def append(self, data, next_node=None): </s> remove     "        node = Node(data)\n",
 </s> add     "        node = Node(data, next_node)\n", </s> remove     def __init__(self, data):
        self.next = None
 </s> add     def __init__(self, data, next_node=None):
        self.next = next_node
  
  class LinkedList(object):
      def __init__(self, head):
          self.head = head








      
      def insert_to_front(self, data):
          if data is None:
              return
          node = Node(data)
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 Updated Node and LinkedList to allow setting the next pointer on init, or when appending a node.  This is useful for circular linked list problems. 
linked-lists/linked_list.py