Iterating over L in F Don't know how nobody did this but it seems intrinsic


Iterating over a list in a function

n =[3, 5, 7]
def total(numbers):
result = 0
for n in range(len(numbers[n])):
result += numbers[n]
return result

How am I still lost. I put in the work tried several ways. By my understanding this should work perfectly. I can't understand for the life of me how I keep getting: list indexes must be integers not lists. I understood the aim perfectly so how is still getting assorted? Trawled deep into it. I understand steps steps to prove you did it but please I must understand the flow don't feed the ducks. Much thanks for deep help.

Replace this line with your code.


The range should be range(len(numbers))


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