Computer Science, asked by drishtisolanki051, 9 months ago

Write a program that takes any two lists L and M of the same size and adds their elements together to form a new list N whose elements are sums of the corresponding elements in L and M. For instance, if L=[3,1,4] and M=[1,5,9],then N should equal[4,6,13].
Note: It is a question of list manipulation from Python programming language.

Answers

Answered by DSaiKiran
14

Explanation:

L=[3,1,4]

M=[1,5,9]

N=[ ]

for i in range(0,len(L)):

N.append(L[i]+M[i])

print(N)

Answered by prakharagrawal6055
0

Answer:

L=eval(input("Enter first list of numbers:"))

M=eval(input("Enter second list of numbers(of same size):"))

N=[]

if len(L)==len(M):

   for i in range(len(L)):

       N.append(L[i]+M[i])

   print("New list of sum of the corresponding elements in l and m is:",N)

else:

   print("Both lists are not of same size")

Explanation:

Similar questions