The inputs will be lists (which is the number of list is indefinite), the function is supposed to iterate through all the index and add each value of the list for same index for all the inputted list mathematically together. The output will be the a list which consist of all the added values
For example: lista = [1,2,3] listb = [2,3,5] listc = [-3,2,1] outputlist = [0,7,9] My function below is only able to add 2 list together, I want no restrictions as to how many list. How do I do that? Thank you very much in advance
def listadd(a,b):
counter = 0
list = []
while counter < len(a):
list.append(a[counter]+b[counter])
counter += 1
return list