# WAP IN PYTHON TO CREATE THE LINKED LIST # HOW WE CAN CREATE THE LINKEDLIST IN PYTHON ==================================================== # Creation of linkedlist class Node: # general structure of node in a linkedlist def __init__(self,data = None): self.data = data self.next = None class singleLinkedList: def __init__(self): self.head = None l1 = singleLinkedList() l1.head = Node("Monday") l2 = Node("Tuesday") l3 = Node("Wednesday") l4 = Node("Thursday") l5 = Node("Friday") l6 = Node("Saturday") l7 = Node("Sunday") l1.head.next = l2 l2.next = l3 l3.next = l4 l4.next = l5 l5.next = l6 l6.next = l7 ============================================== # WAP in python to print the data of linked list ================================================ # WAP to traverse on the linked list in Python =============================================== # Printing of linkedlist data # Creation of linkedlist class Node: # general structure of node in a linkedlist def __init__(self,data = None): self.data = data self.next = None class singleLinkedList: def __init__(self): self.head = None def printLinkedList(self): value = self.head # Traversing on the linkedlist while value is not None: print(value.data) value = value.next l1 = singleLinkedList() l1.head = Node("Monday") l2 = Node("Tuesday") l3 = Node("Wednesday") l4 = Node("Thursday") l5 = Node("Friday") l6 = Node("Saturday") l7 = Node("Sunday") l1.head.next = l2 l2.next = l3 l3.next = l4 l4.next = l5 l5.next = l6 l6.next = l7 l1.printLinkedList() ================================================== # WAP to insert the data into linked list ==========================================