Programming Examples
Python program that takes any two list L and M of the same size and adds their elements together in another third list

Write a python program that takes any two list L and M of the same size and adds their elements together to from 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] the N should equal [4,6,13].
print("Enter Two list of same Size")
L=eval(input("Enter List 1 : "))
M=eval(input("Enter list 2 : "))
N=[]
if len(L)!=len(M):
print("The size of both list are not same : ")
else:
for a in range(0,len(M)):
N.append(L[a]+M[a])
print("Result List :",N)
Output
Enter Two list of same Size
Enter List 1 : [4,5,3,5,6]
Enter list 2 : [3,2,3,4,5]
Result List : [7, 7, 6, 9, 11]
>>>Â
========================Â
Enter Two list of same Size
Enter List 1 : [1,2,3,4]
Enter list 2 : [1,2,4]
The size of both list are not same :Â