Iteration error


How should I correct this code ?


The return statement is indented too far so now it is a part of the for loop. Adjust the indentation level so it is in the function, but not in the for loop.


Sorta like this:

n = [3, 5, 7]

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

This is a follow up kinda thing to what @mkordik said.


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