What does the 'i' in most python for loops stand for | Sololearn: Learn to code for FREE!


What does the 'i' in most python for loops stand for

what i mean is I normally see stuffs like this for i in range(1,10): print i is the 'i' some kinda keyword or something

2/7/2017 10:30:35 PM

Prince Kelvin

9 Answers

New Answer


Nope 'i' is not a keyword! you can use a word instead(ur wish).. It is like》 for i in range(x)#means for 'eachvalue' in range 'x' print i # this gives all in 'x' range


》for loop def: " for everything in this range () of data apply the following condition"


it's a variable for the iteration. could be anything else except reserved keywords. for x in range(1,10) print x for james in range(1,10) print james for this_is_the_iterator in range (1,10) print this_is_the_iterator


"i" is a temporary variable used to store the integer value of the current position in the range of the for loop that only has scope within its for loop. You could use any other variable name in place of "i" such as "count" or "x" or "number". For instance in your for loop above, during the first iteration of the loop i = 1, then i=2 for the next iteration then, i= 3 and so on.


i stands for id01t which is what makes the code possible


thanks guys... beginner's ignorance


it's short for iterator but a simple variable.


although it can be anything, get use to using i. it is easy and it is how it is done in more languages.. Java for example is taught with for(int i=0; i<10; i++){ }


variable. Short version of word "index"