I am new to python and mostly fumble through these lessons.
I am trying to iterate over a list in a function using indexes.
This is topic 15 of lists and functions. There are two ways suggested to do this. This is the second way.
I get this error
File "python", line 7
SyntaxError: 'return' outside function
I expect it to up the numbers in a list.
n = [3, 5, 7] def total(numbers): result = 0 for i in range(len(numbers)): result = result + numbers[i] return total(n)