What does the 'i' in most python for loops stand for | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

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

7th Feb 2017, 10:30 PM
Prince Kelvin
Prince Kelvin - avatar
9 Answers
+ 16
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
7th Feb 2017, 10:39 PM
Akbar Zack Raheem
Akbar Zack Raheem - avatar
+ 10
》for loop def: " for everything in this range () of data apply the following condition"
7th Feb 2017, 10:41 PM
Akbar Zack Raheem
Akbar Zack Raheem - avatar
+ 9
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
7th Feb 2017, 10:34 PM
Mario L.
Mario L. - avatar
+ 4
"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.
7th Feb 2017, 10:37 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
i stands for id01t which is what makes the code possible
8th Feb 2017, 4:28 AM
Ahri Fox
Ahri Fox - avatar
+ 2
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++){ }
7th Feb 2017, 10:36 PM
LordHill
LordHill - avatar
+ 2
thanks guys... beginner's ignorance
8th Feb 2017, 10:07 AM
Prince Kelvin
Prince Kelvin - avatar
+ 1
it's short for iterator but a simple variable.
7th Feb 2017, 10:35 PM
Yargi
Yargi - avatar
0
variable. Short version of word "index"
7th Feb 2017, 10:34 PM
Zilvinas Steckevicius
Zilvinas Steckevicius - avatar