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


#1

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)


#2

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?


#3

this is what it looks like with the indents


#4

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


#5

oh yeah... Thank you so much


#7

thanks buddy !!! :grin: