about summary refs log blame commit diff
path: root/users/wpcarro/scratch/facebook/delete-node.py
blob: 4034449ef0cdaeb0e81e7410f49bc87cbfb77c21 (plain) (tree)


















                                       
from linked_list import Node, from_list

def delete(node):
    if not node.next:
        node.value = None
    else:
        node.value = node.next.value
        node.next = node.next.next

one = Node(1)
two = Node(2)
three = Node(3)

one.next = two
two.next = three

print(one)
delete(two)
print(one)