"Oops, try again. total([0, 3, 6]) returned 0 instead of 9" is what's returned but I can't find my mistakes, please help


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

n = [3, 5, 7]

def total(numbers):
result = 0
for i in numbers:
result += i
return result

<do not remove the three backticks above>

#2

@supremeidi

Hi,

Can you tell me where did you define variable i?


#3

Hi you should not put the return statement inside the for loop bu inside the function total

@miniapple8888 he used it inside the for loop


#4

@wizmarco

Ahh I see now! :sweat_smile: Thanks for pointing that out. I was too focused on the return statement. :wink:


#5

Problem solved, thanks for the feedback!