It says,"Oops, try again. total([0, 3, 6]) returned 6 instead of 9".Please help me find the mistake


#1



https://www.codecademy.com/courses/python-beginner-nzzVa/3/4?curriculum_id=4f89dab3d788890003000096


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


Next


n = [3, 5, 7]

def total(numbers):
    result =0
    if i in range(len(numbers)):
        result = result + numbers[i]
    return result


#2

here:

if i in range(len(numbers)):

Why use if? What you seems to do requires a loop to get all values from numbers list


#3

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