What exactly needs to be done in "Iterating over a list in a function"


Oops, try again. total([0, 3, 6]) returned 15 instead of 9 - Error msg

n = [3, 5, 7]

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


sorry for the numerous edits. I think the problem is that it should be def total(n) not the way you put it


Thanks!! It worked. I got the flow.


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