class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def valueToNode(num):
head = ListNode(0)
node = head
while num > 0:
node.next = ListNode(num % 10)
node = node.next
num //= 10
return head.next
def printNode(n):
while n != None:
print(n.val, end = '')
n = n.next
print()
# Case 1
n1 = 342
n2 = 465
l1 = valueToNode(n1)
l2 = valueToNode(n2)
answer = Solution().addTwoNumbers(l1, l2)
printNode(answer)
# Case 2
n1 = 342
n2 = 10
l1 = valueToNode(n1)
l2 = valueToNode(n2)
answer = Solution().addTwoNumbers(l1, l2)
printNode(answer)
# Case 3
n1 = 342
n2 = 8
l1 = valueToNode(n1)
l2 = valueToNode(n2)
answer = Solution().addTwoNumbers(l1, l2)
printNode(answer)
# Case 4
n1 = 342
n2 = 0
l1 = valueToNode(n1)
l2 = valueToNode(n2)
answer = Solution().addTwoNumbers(l1, l2)
printNode(answer)
# Case 5
n1 = 342
n2 = 800
l1 = valueToNode(n1)
l2 = valueToNode(n2)
answer = Solution().addTwoNumbers(l1, l2)
printNode(answer)