"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



n = [3, 5, 7]

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


#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!