Iterating over a list in a function
I am just following the instructions but no output.
This is the error message and code below. Not able to figure out the mistake.
Traceback (most recent call last):
File "python", line 7, in
NameError: name 'result' is not defined
n = [3, 5, 7] def total(numbers): result = 0 for i in range(len(numbers)): result = result + i return result print result