Build a Linked List - Step 12

Tell us what’s happening:

I get the error message:

/ running tests
2. You should assign current_node.next to current_node inside the while loop.
// tests completed
// console output
True

Your code so far

class LinkedList:
    class Node:
        def __init__(self, element):
            self.element = element
            self.next = None
            
    def __init__(self):
        self.length = 0
        self.head = None

    def is_empty(self):
        return self.length == 0
    
    def add(self, element):
        node = self.Node(element)
        if self.is_empty():
            self.head = node
            


# User Editable Region

        else:
            current_node = self.head
            while current_node.next is not None:
                current_node.next = current_node
    



my_list = LinkedList()

# User Editable Region

print(my_list.is_empty())

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0

Challenge Information:

Build a Linked List - Step 12

think about what you are assigning to what when you use =

Thank you! Sometimes errors like this seems to happend :joy: