0
why is that, in the iteration of 'for i in list[]:', we do not have to initialize or increment 'i'?
3 Respostas
+ 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
- 1
'i' acts as a temperory variable which you don't need to initialize
- 1
python automatically initialize a temporary variable (i) and starts with index 0 to the size of list - 1