12/15 Iterating over a list in a function help PLEASE


What am I doing wrong here?

n = [3, 5, 7]

def total(numbers):
result = 0
for i in range(len(numbers)):
result = result + numbers[i]
return result

print total(n)


Since we cannot see the indentation I'm going to go out on a limb and suggest checking the indentation on return. Does it line up with for (4 spaces) or is it in the loopt?


this is what it looks like with the indents


As suspected, the return statement has 8 spaces indent, instead of 4. It should line up with the for.


oh yeah... Thank you so much


thanks buddy !!! :grin: