0
    index = 0
    current = self._head
    prevv = self._head
    temp = self._head
    while current is not None:
        if index == i:
            temp = current.next
            self._num_nodes -=1
            break
        prevv = current
        current = current.next
        index += 1
        prevv.next = temp
        return prevv

I already done when number of node is empty, 1, and I'm removing data in list with given index.(not first index or last index) And I got error that 'list's instance is not equal to number of data object' How can I solve this?

ricollob
  • 21
  • 2
  • Can you first review the answer(s) to your [previous question](https://stackoverflow.com/questions/72009053/how-do-i-rearrange-tail-in-singly-linked-list-in-python)? It is not very motivating to answer questions when there is no feed-back. – trincot Apr 26 '22 at 09:58
  • I suggest you go through the code with a [debugger](https://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems#:~:text=A%20debugger%20is%20a%20program,while%20your%20program%20is%20running.) to see what's happening. Can you clarify more about what you need do? – Alias Cartellano Apr 26 '22 at 22:33
  • Does this answer your question? [How do I rearrange tail in singly linked list in python?](https://stackoverflow.com/questions/72009053/how-do-i-rearrange-tail-in-singly-linked-list-in-python) – CKE Apr 29 '22 at 05:09

0 Answers0