+ 1

in " for I in range (5)" what do you mean by"i"? who defined this?

do we have to define it? and what if multiple ranges exist in the programme?

13th Jul 2016, 4:26 PM
Yuktee Gupta
Yuktee Gupta - avatar
2 Réponses
+ 3
@Yuktee Gutta 'i' is a temperory variable or placeholder we create inorder to access it within a loop you don't need to declare it actually you are declaring it in for loop itself for i in range(5): print(i) It is not compulsory to give only 'i' you can use anything you want example for nums in range(5): print(nums)
13th Jul 2016, 4:34 PM
sundar
sundar - avatar
+ 1
The "I" is a variable that hold the value and iterate our program. It is just a convention i.e. we can use any identifier or any character for the same.
13th Jul 2016, 9:20 PM
Shriram Moond
Shriram Moond - avatar