<filename>Data Structures/Arrays and Linked List/linked_lists/linked_lists_intro_solution_05.py
def create_linked_list_better(input_list):
    
    head = None
    tail = None
    
    for value in input_list:
        
        if head is None:
            head = Node(value)
            tail = head # when we only have 1 node, head and tail refer to the same node
        else:
            tail.next = Node(value) # attach the new node to the `next` of tail
            tail = tail.next # update the tail
            
    return head
<filename>Data Structures/Arrays and Linked List/linked_lists/linked_lists_intro_solution_05.py
def create_linked_list_better(input_list):
    
    head = None
    tail = None
    
    for value in input_list:
        
        if head is None:
            head = Node(value)
            tail = head # when we only have 1 node, head and tail refer to the same node
        else:
            tail.next = Node(value) # attach the new node to the `next` of tail
            tail = tail.next # update the tail
            
    return head
# when we only have 1 node, head and tail refer to the same node # attach the new node to the `next` of tail # update the tail