class Empty(Exception): pass class Linklist: class _Node: # Nonpublic class for storing a linked node __slots__='_element','_next' def __init__(self,ele,ne): self._element=ele self._next=ne def __init__(self): self._head=None self._size=0 self._tail=…