def append(head, data):
    new_node = {"data": data, "next": None}
    if head is None:
        return new_node
    current = head
    while current["next"] is not None:
        current = current["next"]
    current["next"] = new_node
    return head

head = append(head, 40)
display(head)
