I am writing code about two lists and the sum element without using the sum function. So I need to return the sum of its elements. How do I define a list c with the total number of list a and b
The code below is what I already tried.
def add(list_a, list_b):
list_a = [1, 2, 3, 4, 5]
list_b = [1, 2, 3, 4, 5]
list_c = []
for i in range (0,5):
list_c.append(list_a[i]+second[i])
print (list_c)
The error code:
File "sum.py", line 7, in
list_c.append(list_a[i]+second[i])
NameError: name 'list_c' is not defined