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

Why does the solution ask for an “i”? Shouldn’t it be an “n” as the list it’s calling from?

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

Why does the solution ask for an “i”? Shouldn’t it be an “n” as the list it’s calling from?

actually not, lets add some function calls so we can see it better:

```
n = [3, 5, 7]
def total(numbers):
result = 0
for i in range(0,len(numbers)):
result += numbers[i]
return result
print total(n)
print total([2,4,8])
```

you pass the list `n`

as argument on function call, so value of `n`

get passed to the function parameter `numbers`

using `n`

for the loop iterator would be confusing, then it would be challenging to remember which is the list and which the loop iterator. Now in a program this small, its maybe a bit less relevant.

i am slightly confused, most people confuse `n`

and `numbers`

, not `n`

and `i`

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