title: Python LinkedList with 2 pointers
body: <pre><code>class Node:
      def __init__(self, node_data):
          self.data = node_data
          self.next = None
  
  class LinkedList:
      def __init__(self):
          self.head = None
          self.tail = None
  
      def insert_node(self, node_data):
          node = Node(node_data)
  
          if not self.head:
              self.head = node
          else:
              self.tail.next = node
  
  
          self.tail = node
  
  # Complete the printLinkedList function below.
  
      def printList(self):
          while self.head is not None:
              print(self.head.data)
              self.head = self.head.next
  
  l = LinkedList()
  l.insert_node(5)
  l.insert_node(10)
  l.insert_node(19)
  l.printList()
  </code></pre>
  
  <p>I am trying to implement linkedlist using iterative method. I have 2 pointer(head, tail). so is there anyway to avoid using 2 pointers without recursion. and for printList function is is a good practice to use only head pointer. any feedback is appreciated</p>