+ 2
Why is iter() needed here?
code: l = [1, 2, 3, 4] l = iter(l) for i in l: print(i, next(l)) Why do you have to call iter() when the for loop already has done that?
2 Answers
+ 9
For behind the scenes use iter so in that scenario in one loop you process two values.
+ 4
For fun ;-)