Please explain "i" in this example code


#1

https://www.codecademy.com/courses/learn-python/lessons/lists-and-functions/exercises/modifying-each-element-in-a-list-in-a-function?action=resume_content_item

Hi, I’m trying to get a better understanding of what “i” is in the existing code. It’s been used several times in the same lesson but it has no explanation of how it works in each example. Thank you so much.


#2

i is a common variable to use in iteration. It is locally defined, and acts as the temporary index for each value in the list, in turn.


#3

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