Hi - found your code when searching for Python Linked List. Curious why you made insertNode so "complex"? It looks more like appendNode. Couldn't you just do:
def insertNode(head, valuetoInsert):
newNode = linkedListNode(valuetoInsert)
newNode.nextNode = head
return newNode
Hi - found your code when searching for Python Linked List. Curious why you made insertNode so "complex"? It looks more like appendNode. Couldn't you just do: