Insert a Node at the Tail of a Linked List python HackerRank
<p>Its a very simple program of adding a node at the end of a link list. I dont know what mistake I am doing. has it something to do with the exoected output of hackerRank or there's a mistake in my code.
I m trying to implement the Python2</p>

<pre><code>class Node(object):

   def __init__(self, data=None, next_node=None):
       self.data = data
       self.next = next_node
def Insert(head, data):

    if (head.head == None):
        head.head = Node(data)
    else:
        current = head.head
        while (current.next != None) and (current.data == data):
                           current = current.next
        current.next = Node(data)
</code></pre>

<p>Heres a link to the question.
<a href="https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list" rel="nofollow">https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list</a></p>