• + 0 comments

    python3

    class Node:
        def __init__(self,data):
            self.data=data
            self.next=None
    class SinglyLinkedList:
        def __init__(self):
            self.head=None
        def insert_node(self,data):
            node=Node(data)
            node.next=self.head
            self.head=node
    def reversePrint(head):
        current=head
        while current:
            print(current.data)
            current=current.next