20
loading...
This website collects cookies to deliver better user experience
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
LL = LinkedList()
LL.head = Node(10)
second = Node(11)
third = Node(12)
LL.head.next = second
second.next = third
class LinkedList:
def __init__(self):
self.head = None
def printList(self):
temp = self.head
while temp:
print(temp.data)
temp = temp.next
LL.printList()
10
11
12
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def printList(self):
temp = self.head
while temp:
print(temp.data)
temp = temp.next
LL = LinkedList()
LL.head = Node(1)
second = Node(2)
third = Node(3)
LL.head.next = second
second.next = third
LL.printList()