Iterating over a list in a function


#1

my code here:

n = [3, 5, 7]

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

it keeps on loading, what am I doing wrong here? please help!


#2

here:

for i in range(len(list)):

where is list defined? And why are you looping over list?


#3

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