Write a function Sumlist(A,B) in Python, which accepts two lists A and B of the
same size and adds their elements together to form a new list C whose
elements are sum of the corresponding elements in A and B .
For Example : if A=[3,1,4] and B=[1,5,9] then C= [4,6,13]
Answers
Answered by
3
sumlist = lambda a, b: [x + y for (x, y) in zip(a, b)]
A, B = [3, 1, 4], [1, 5, 9]
C = sumlist(A, B)
print(C)
Similar questions