Build a Linked List - Step 11

Tell us what’s happening:

Hi, I’m stuck on Step 11.

My logic is correct (using a while loop to find the end of the list), but I keep getting this error:
“You should assign self.head to current_node inside the else block.”
My indentation is correct. Is this a bug with the test runner? Any help is appreciated!

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):
# User Editable Region
        node = self.Node(element)
        if self.is_empty():
            self.head = node
        else:
            current_node = self.head
            while current_node.next is not None:
                current_node = current_node.next
            current_node.next = node

my_list = LinkedList()
print(my_list.is_empty())
# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36 Edg/154.0.0.0

Challenge Information:

Build a Linked List - Step 11

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-linked-list-class/688649c8673f842f49228a5e.md at main · freeCodeCamp/freeCodeCamp · GitHub

Are you sure you are asked to create a while loop here?