human
2. Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example
Input: (2 -&gt.
4 -&gt.
3) + (5 -&gt.
6 -&gt.
4)
Output: 7 -&gt.
0 -&gt.
8
Explanation: 342 + 465 = 807."
Please write code following the instructions in jupyter notebook style.

=====
Give me a code to 2?
assistant
#Here is code to 2.

class Node:
    def __init__(self, val=None, nex=None):
        self.val = val
        self.next = nex

    def __str__(self):
        s = ''
        nn = self
        while True:
            s = s+str(nn.val)+' -> '
            nn = nn.next
            if nn is None:
                break
        return s

carry = 0

def add(n1, n2):
    global carry
    v1 = int(n1.val) if n1 else 0
    v2 = int(n2.val) if n2 else 0
    summ = carry + v1 + v2
    v = summ % 10
    carry = summ // 10
    return Node(v)

def next_nodes(n1, n2):
    n1 = n1.next if n1 else None
    n2 = n2.next if n2 else None
    return n1, n2

def add_nodes(h1, h2):
    if h1 is None:
        return h2
    elif h2 is None:
        return h1
    else:
        n1, n2 = h1, h2

    head = add(n1, n2)
    n = head
    while True:
        n1, n2 = next_nodes(n1, n2)
        n.next = add(n1, n2)
        n = n.next
        if n1 == None and n2 == None:
            break
    return head

head1 = Node(2, Node(4, Node(3, Node(5, Node(1)))))
head2 = Node(5, Node(6, Node(4)))
h12 = add_nodes(head1, head2)

print(head1)
print(head2)
print(h12)