'I am trying to print the elements of linked list after adding it but it doesn't seem to work

I am trying to show the items in my linked list after inserting them with the function Add, and view function to print but it doesn't seem to work.

class Node():
    def __init__(self,value):
        self.value = value
        self.next = None
class Linked_List():
    def  __init__(self):
        self.head = None
        self.tail = None
    def Add(self,value):
        if(self.head == None):
            n = Node(value)
            if(self.head == None):
                self.head = n
            else:
                self.tail.next  = n
            self.tail =  n
def view(head):
        curr = head
        while (curr):
                print(curr.value,"-->")
                curr = curr.next


newlist = Linked_List()
newlist.Add(5)
newlist.Add(6)
newlist.Add(56)
view(newlist.head)

It only shows the first element 5 and doesn't show the rest. I can't seem to understand the reason even if i have done acc. to the algo??

Thanku in advance.



Solution 1:[1]

If head is not Null, Add doesn't do anything, which even the most rudimentary debugger would have made clear.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Scott Hunter