• + 0 comments

    python 3:

    def insert(self, head, data):
        new_node = Node(data)
        if head is None:
            head = new_node
        else:
            current = head
            while current.next:
                current = current.next
            current.next = new_node
        return head