Iteration error


#1

How should I correct this code ?


#2

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.


#3

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.


#4

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