Add two numbers stored in reverse

Two non-negative numbers are stored as linked lists of digits, least significant digit first: 342 is 2 -> 4 -> 3. Write add(a, b) that returns their sum as a new linked list in the same form.

add(2 -> 4 -> 3, 5 -> 6 -> 4)  ->  7 -> 0 -> 8       (342 + 465 = 807)
add(9 -> 9, 1)                 ->  0 -> 0 -> 1       (99 + 1 = 100)

The point is to practise walking two lists together with a carry, and building the result with a tail pointer.

def add(a, b):
    ...