sequences and the last item in the linked list they both point to dummy node to begin with this dummy node will always be in the first position in the list and will never contain an item its purpose is to eliminate special cases in the code below self first linkedlist __node(none,noneself last self first self numitems for in contentsself append(ecreating linkedlist object has exactly the same complexity has constructing list object if an empty list is createdthen the time taken is ( and if list is copiedthen it is (noperation linkedlist object has references to both ends of the linked list the reference to the head of the list points to dummy node having dummy node at the beginning eliminates many special cases that would exist when the list was empty if no dummy node were used declaring the node class within the linkedlist classand preceding the name with two underscoreshides the __node class from any code outside the linkedlist class the idea here is that only the linkedlist class needs to know about the __node class initiallyboth the first and the last references point to the dummy node the append method is used to add elements to the linkedlist should list be passed to the constructor linkedlist get and set def __getitem__(self,index)if index > and index self numitemscursor self first getnext(for in range(index)cursor cursor getnext( return cursor getitem( raise indexerror("linkedlist index out of range" def __setitem__(self,index,val)if index > and index self numitemscursor self first getnext(for in range(index)cursor cursor getnext( cursor setitem(valreturn raise indexerror("linkedlist assignment index out of range"implementations for the indexed get and set operations are included in sect largely as an example of traversing linked list they are of little practical value if random access to list is desiredthen the list class should be used linked lists are not randomly accessible they require linear search through the datatype to access particular location in the list each of these operations is (nwhere is the value of the index this copy belongs to 'acha