list headval nextval nextval list atbegining("sun"list listprint(when the above code is executedit produces the following resultsun mon tue wed inserting at the end this involves pointing the next pointer of the the current last node of the linked list to the new data node so the current last node of the linked list becomes the second last data node and the new node becomes the last node of the linked list class nodedef __init__(selfdataval=none)self dataval dataval self nextval none class slinkedlistdef __init__(self)self headval none function to add newnode def atend(selfnewdata)newnode node(newdataif self headval is noneself headval newnode return laste self headval while(laste nextval)laste laste nextval laste nextval=newnode