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


#1


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


#2

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


#3

Thanks!! It worked. I got the flow.


#4

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