I need solution to sum (addition) of each items of having same index. I find the solution using map, zip, list comprehension. Is there any solution defining function. My attempt:
a = [1,2,3]
b = [4,5,6]
def add(a,b):
for x in a:
return(x)
def add1(x,b):
for b in b:
return x + b
print (add(a,b))
Output from above is 1 which is wrong
Expected output :[5,7,9]
[5, 7, 9]?