Stick with Numpy array and use its sum() method:

>>> arr = np.array([[1,2,3,5,4,3], 
          [5,7,2,4,6,7],
          [3,6,2,4,5,9]])
>>> arr.sum(axis=0)
array([ 9, 15,  7, 13, 15, 19])

Of course you can do it with Python lists as well but it is going to be slow:

>>> lst = [[1,2,3,5,4,3], 
          [5,7,2,4,6,7],
          [3,6,2,4,5,9]]
>>> map(sum, zip(*lst))
[9, 15, 7, 13, 15, 19]
Answer from Ashwini Chaudhary on Stack Overflow
๐ŸŒ
Medium
medium.com โ€บ @pythonchallengers โ€บ numpy-challenge-adding-two-arrays-ec612ce78c1
NumPy Challenge: Adding two arrays | by Python Challengers | Medium
December 6, 2023 - def arrays_sum(arr1, arr2). Here, a function named arrays_sum is defined. It takes two arguments: arr1 and arr2.
๐ŸŒ
Quora
quora.com โ€บ How-do-you-sum-two-arrays-in-Python
How to sum two arrays in Python - Quora
Answer: Itโ€™s very simple. You need to know the following two things before. 1. python has a built in method called sum() which will take an array as argument , sum the elements and return the sum. 2. The + operator can be used to add two arrays. Example [1,2] + [3,4] = [1,2,3,4] Using this ...
Discussions

Sum of Two Arrays - Python - Stack Overflow
Two random integer arrays/lists have been given as ARR1 and ARR2 of size N and M respectively. Both the arrays/lists contain numbers from 0 to 9(i.e. single digit integer is present at every index)... More on stackoverflow.com
๐ŸŒ stackoverflow.com
December 4, 2020
python - Add SUM of values of two LISTS into new LIST - Stack Overflow
I have the following two lists: first = [1,2,3,4,5] second = [6,7,8,9,10] Now I want to add the items from both of these lists into a new list. output should be third = [7,9,11,13,15] More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - Summing each element of two arrays - Stack Overflow
I have two arrays and want to sum each element of both arrays and find the maximum sum. More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to sum two arrays in Python? - Stack Overflow
(Iteration through a numpy array is relatively slow at the python level compared to lists.) For a small array, it won't matter much, but it will be needlessly slow and memory-inefficient for larger arrays. 2015-02-03T17:56:44.797Z+00:00 ... Vor; your code only gives the sum of first and second year not the cumulative. like when i gave my_func(1851, 1852) it gave 4 but it should be 13, thanks a lot 2015-02-03T18:03:50.113Z+00:00 ... Hi all, thanks a lot, but, i gave two ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
DEV Community
dev.to โ€บ sfrasica โ€บ algorithm-practice-sum-two-arrays-927
Algorithm Practice: Sum Two Arrays - DEV Community
October 29, 2020 - "Your task is to create a function called sum_arrays() in Python or addArrays in Javascript, which takes two arrays consisting of integers, and returns the sum of those two arrays.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 65142054 โ€บ sum-of-two-arrays-python
Sum of Two Arrays - Python - Stack Overflow
December 4, 2020 - Copydef sum_two_array(L1, L2): carry, total = 0, 0 m, n = len(L1), len(L2) k = max(m, n) result = [0] + [0] * k # add +1 for i in range(1, k+1): a = L1[m-i] if m - i >= 0 else 0 b = L2[n-i] if n - i >= 0 else 0 total = a + b + carry result[k-i + 1] = total % 10 carry = total // 10 if carry > 0: result[0] = carry return result if result[0] != 0 else result[1:] if __name__ == '__main__': L1 = [6, 4, 4] L2 = [7, 5, 6] print(sum_two_array(L1, L2)) # [1, 4, 0, 0] print(sum_two_array([6, 2, 4], [7, 5, 6])) # [1, 3, 8, 0] print(sum_two_array([1, 2, 4], [8, 0])) # [2, 0, 4]
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ numpy-add-in-python
numpy.add() in Python - GeeksforGeeks
July 11, 2025 - Here's In this example, we have two NumPy arrays, array1 and array2, of the same size. The np.add() function is applied to add the corresponding elements of the two arrays. The result is a new array with the sum of the corresponding elements.
๐ŸŒ
Data Science Parichay
datascienceparichay.com โ€บ home โ€บ blog โ€บ numpy โ€“ elementwise sum of two arrays
Numpy - Elementwise sum of two arrays - Data Science Parichay
June 17, 2022 - The array x3 is the result of the elementwise summation of values in the arrays x1 and x2. Alternatively, you can also use the + operator to add numpy arrays elementwise.
Find elsewhere
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ third party โ€บ numpy โ€บ add()
Python Numpy add() - Perform Element-wise Addition
November 5, 2024 - array1 = np.array([[1, 2], [3, 4]]) array2 = np.array([[5, 6], [7, 8]]) result = np.add(array1, array2) print(result) ... Here, numpy.add() adds each corresponding element of the two matrices, resulting in [[6 8] [10 12]].
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ numpy-sum-in-python
numpy.sum() in Python | DigitalOcean
Technical tutorials, Q&A, events โ€” This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
Top answer
1 of 7
3

Well, all other answers are awesome for adding 2 numbers (list of digits).
But in case you want to create a program which can deal with any number of 'numbers',

Here's what you can do...

def addNums(lst1, lst2, *args):
    numsIters = [iter(num[::-1]) for num in [lst1, lst2] + list(args)]  # make the iterators for each list
    carry, final = 0, []                                                # Initially carry is 0, 'final' will store the result
    
    while True:
        nums = [next(num, None) for num in numsIters]                   # for every num in numIters, get the next element if exists, else None
        if all(nxt is None for nxt in nums): break                      # If all numIters returned None, it means all numbers have exhausted, hence break from the loop
        nums = [(0 if num is None else num) for num in nums]            # Convert all 'None' to '0'
        digit = sum(nums) + carry                                       # Sum up all digits and carry
        final.append(digit % 10)                                        # Insert the 'ones' digit of result into final list
        carry = digit // 10                                             # get the 'tens' digit and update it to carry

    if carry: final.append(carry)                                       # If carry is non-zero, insert it
    return final[::-1]                                                  # return the fully generated final list

print(addNums([6, 9, 8], [5, 9, 2]))                                    # [1, 2, 9, 0]
print(addNums([7, 6, 9, 8, 8], [5, 9, 2], [3, 5, 1, 7, 4]))             # [1, 1, 2, 7, 5, 4]

Hope that makes sense!

2 of 7
1

If I understand correctly you want it like this: [6, 9, 8], [5, 9, 2] -> 698 + 592 = 1290 -> [1, 2, 9, 0]

In that case my first idea would be to turn the numbers into strings, combine them to one string and turn it into an int, then add both values together and turn into a list of integers again... you can try this:

def get_sum_as_list(list1, list2):
    first_int = int(''.join(map(str,list1)))
    second_int = int(''.join(map(str,list2)))
    result = [int(num) for num in str(first_int+second_int)]
    return result
๐ŸŒ
DevCodeTutorial
devcodetutorial.com โ€บ faq โ€บ sum-of-two-arrays
Sum of Two Arrays - Python-3.x
June 13, 2022 - 1 Python3. total = 0. list1 = [11, ... Python3. 4 Python3. Method 2: Using the sum () function in NumPy, numpy.sum (arr, axis, dtype, out) function returns the sum of array elements over the specified axis....
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ generated โ€บ numpy.add.html
numpy.add โ€” NumPy v2.1 Manual
>>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> x1 + x2 array([[ 0., 2., 4.], [ 3., 5., 7.], [ 6., 8., 10.]])
๐ŸŒ
The Renegade Coder
therenegadecoder.com โ€บ code โ€บ how-to-sum-elements-of-two-lists-in-python
How to Sum Elements of Two Lists in Python: Comprehensions and More โ€“ The Renegade Coder
May 27, 2024 - In short, one of the best ways to sum elements of two lists in Python is to use a list comprehension in conjunction with the addition operator.
๐ŸŒ
CodeSpeedy
codespeedy.com โ€บ home โ€บ addition of two arrays in python
How to add two arrays in Python - CodeSpeedy
February 12, 2020 - It is the same as adding two values. The arrays act as operands and โ€˜+โ€™ is the operator. Syntax: #let arr1 and arr2 be arrays res = arr1 + arr2 ยท Letโ€™s move to some examples to verify the same. #Python program to show addition of 2 arrays using + operator import numpy as np #define 2 different arrays arr1 = np.array([1,2,3,4]) arr2 = np.array([1,2,3,4]) res = arr1 + arr2 res
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 53075198 โ€บ python-sum-two-numbers-represented-as-two-arrays โ€บ 53092106
python sum two numbers represented as two arrays - Stack Overflow
Copyfrom functools import reduce arr1 = [3,2,1] arr2 = [2,5] def sum_func(*args): return sum(int(''.join(map(str, reversed(arr)))) for arr in args) def mult_func(*args): return reduce(lambda x, y: x*y, [int(''.join(map(str, reversed(arr)))) for arr in args]) print(123 + 52) print(sum_func(arr1, arr2)) >>>175 >>>175 print(123 * 52) print(mult_func(arr1, arr2)) >>6396 >>6396
๐ŸŒ
Data Science Dojo
discuss.datasciencedojo.com โ€บ python
How to add two lists or Numpy arrays together? - Python - Data Science Dojo Discussions
November 23, 2022 - The numpy.add() function calculates the element-wise sum of two NumPy arrays or lists. It takes two arrays or lists as input and returns a new array that is the result of adding each element in the first array to the corresponding element in ...