0

why is that, in the iteration of 'for i in list[]:', we do not have to initialize or increment 'i'?

29th Jul 2016, 9:33 PM
Jerson Hidalgo
Jerson Hidalgo - avatar
3 odpowiedzi
+ 1
Basically python is doing the work for you since it is a very common task. You give it a variable name i and since python knows a list is iterable it just does it
30th Jul 2016, 1:09 AM
Max Pickup
Max Pickup - avatar
- 1
'i' acts as a temperory variable which you don't need to initialize
30th Jul 2016, 2:28 AM
sundar
sundar - avatar
- 1
python automatically initialize a temporary variable (i) and starts with index 0 to the size of list - 1
2nd Aug 2016, 7:07 AM
Ali
Ali - avatar