Skip to content

Commit

Permalink
Update Python Program to Reverse a linked list.py
Browse files Browse the repository at this point in the history
Updated print statements to match current syntax
  • Loading branch information
Piombacciaio authored Jul 30, 2023
1 parent 85a68dd commit 86981af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Python Program to Reverse a linked list.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def push(self, new_data):
def printList(self):
temp = self.head
while(temp):
print temp.data,
print(temp.data)
temp = temp.next


Expand All @@ -48,10 +48,10 @@ def printList(self):
llist.push(15)
llist.push(85)

print "Given Linked List"
print("Given Linked List")
llist.printList()
llist.reverse()
print "\nReversed Linked List"
print("\nReversed Linked List")
llist.printList()

# This code is contributed by Nikhil Kumar Singh(nickzuck_007)

0 comments on commit 86981af

Please sign in to comment.