Iterating over a list in a function


File "python", line 6
SyntaxError: can't assign to operator

What should I put for the length?

Replace this line with your code. 
n = [3, 5, 7]

def total(numbers):
    result = 0
    for numbers in range(len(2)): 
        numbers + result = result
    return result

print total(n)


numbers is the parameter, so use that.

The assigned expression is always on the right hand side.

x = x + a


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