Skip to content

Commit 89b637a

Browse files
authored
Update Exercise_3.py
1 parent 5e66eae commit 89b637a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Exercise_3.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1+
# Node class
2+
class Node:
3+
4+
# Function to initialise the node object
5+
def __init__(self, data):
6+
7+
class LinkedList:
8+
9+
def __init__(self):
10+
11+
12+
def push(self, new_data):
13+
14+
15+
# Function to get the middle of
16+
# the linked list
17+
def printMiddle(self):
118

19+
# Driver code
20+
list1 = LinkedList()
21+
list1.push(5)
22+
list1.push(4)
23+
list1.push(2)
24+
list1.push(3)
25+
list1.push(1)
26+
list1.printMiddle()

0 commit comments

Comments
 (0)