15, Iterating over a list in a function


Hi, i'm really lost in this one, i don't know what to do :sob: :sob: do i have to add or delete something? i'm really stuck!!

n = [3, 5, 7]

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


ohhhhhh, nevermind, i found out what it is, i'm so stupid :sweat_smile:
when adding the numbers to result, i needed to write numbers[n] not just n heheheeh....


Yeah, good debugging :wink:


thx :blossom: :blossom:


no problem. have a good day


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