python sum lists element wise

Solutions on MaxInterview for python sum lists element wise by the best coders in the world

showing results for - "python sum lists element wise"
Carla
28 Mar 2019
1import numpy as np
2vector1 = np.array([1, 2, 3])
3vector2 = np.array([4, 5, 6])
4
5#Doing the element-wise addition is now as trivial as:
6sum_vector = vector1 + vector2
7print(sum_vector)
8
9# [5 7 9]