The programming language is Python
Instructions:
Create a function that will delete a node in a Linked List based
on position number. On below example, if you want to delete
position #2, it will remove the Banana
(arrangement of nodes below is Apple, Banana, Cherry, Grapes,
Orange).
myLinkedList = LinkedList()
myLinkedList.append("Banana")
myLinkedList.append("Cherry")
myLinkedList.append("Grapes")
myLinkedList.append("Orange")
myLinkedList.prepend("Apple")
myLinkedList.deleteByPositionNum(2)
node = myLinkedList.head
while node:
print(node.value, " ")
node = node.next_node
You may start with the function head:
def deleteByPositionNum(self, positionNum):