singly linked list class list is clearly separate concept from node so we start by creating very simple class to hold our list we will start with constructor that holds reference to the very first node in the list since this list is initially emptywe will start by setting this reference to noneclass singlylinkedlistdef __init__(self)self tail none append operation the first operation that we need to perform is to append items to the list this operation is sometimes called an insert operation here we get chance to hide away the node class the user of our list class should really never have to interact with node objects these are purely for internal use first shot at an append(method may look like thisclass singlylinkedlistdef append(selfdata)encapsulate the data in node node node(dataif self tail =noneself tail node elsecurrent self tail while current nextcurrent current next current next node we encapsulate data in nodeso that it now has the next pointer attribute from here we check if there are any existing nodes in the list (that isdoes self tail point to nodeif there is nonewe make the new node the first node of the listotherwisefind the insertion point by traversing the list to the last nodeupdating the next pointer of the last node to the new node