Implementation of LinkedList in python __getitem__() method
I am implementing a LinkedList in python(3.7.4) and the code of the module is below :- LinkedList.py class Node: def __init__(self,value): self.value = value self.ref = None class LinkedList(Node): def __init__(self): self.__head = None self.__cur = None self.__count = 0 def add(self,value): if self.__head is None: self.__cur = Node(value) self.__head = self.__cur else: self.__cur.ref = Node(value) self.__cur = self.__cur.ref self.__count += 1 def getList(self): temp = self.__head while temp!=None: yield temp.value temp = temp.ref def delete(self,value): temp = self.__head while temp!=None: if