Insert a Node at the Tail of a Linked List

  • + 0 comments

    My code is basically the same other than naming and using "is/is not" for testing if None...

    and it's failing.

    def Insert(head, data):
        if head is None:
            return Node(data)
        here = head
        while here.next is not None:
            here = here.next
        here.next = Node(data)
        return head