0
Adding a list function
Write a function that accepts a list of integers and returns the sum of all the numbers in the list. Assume that the input list contains only numbers. Do NOT use the built-in sum() function. a = [5,6,8,9,7,6] total = 0 def add_num(a): for n in a: total = total + n return total print(add_num(a))
2 Respostas
+ 2
the return is inside the for loop that stops the loop put it outside