Stuck at Iterating over a list in a function


n = [3, 5, 7]
def total(numbers):
    for i in numbers:
    return result
print total(n)

I as totally stuck at this quiz.

Is there any error on my code ??

my code keep making an error... like this

Traceback (most recent call last):
File "C:/Python27/", line 7, in
print total(n)
File "C:/Python27/", line 5, in total
IndexError: list index out of range


With the

for i in numbers:

i will have the actual Array-item-Value
and not the item-index-nr as you thought.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.