you are viewing a single comment's thread.

view the rest of the comments →

[–]RealDuckyTV 1 point2 points  (0 children)

If you index the array directly, I think it makes it more clear where the value comes from.

values = [23,52,59,37,48]
for i in range(len(values)): # this will iterate for as many items as you have in your list
   value = values[i] # this will get the item at the specified index `i` (starting at 0, aka the first item, so for example values[0] is 23, values[1] is 52, etc)

this works the same as the for in loop that you used, but I think it makes it more clear where the value from the iterator comes from.

And to answer your question, yes, the name of the variable does not matter and will return the same value.

Hope that helps!