In the above code, we check if the linked list is empty by checking the head of the linked list. If the self.head is None on line 12, it implies that it’s an empty linked list and there’s nothing there. The head pointer doesn’t point to anything at all, and therefore there is no node in the linked list. If there is no node in the linked list, we set the head pointer to the new_node that we created on line 13. In the next line, we simply return. The case of an empty linked list is relatively easy to handle.