+ 1

Problem

I have some understanding problem with for loops ..please anyone explain and give me about that....

25th Jul 2017, 12:24 PM
Darwin
Darwin - avatar
3 Respuestas
+ 3
What don't you understand in 'for' loops? 'some' isn't enough accurate ^^
25th Jul 2017, 12:44 PM
visph
visph - avatar
+ 1
for i in range(...)/(a tuple )/[a list]/... it just traverse something ,like a tuple,a list or a generator. by the way,range(...) is something like a generator. you can google generator for more information.
25th Jul 2017, 12:58 PM
Allan Chain
Allan Chain - avatar
0
If you're new to it, it can be a bit confusing to understand. Here's an example: for n in range(10): print(n) In puesdocode (Human), this translates to: for each number up to 10 (not including 10 itself), the variable 'n' will become each of those numbers, starting from 0 (default starting point). Each time it loops, print what the variable "n" is onto the console.
25th Jul 2017, 1:28 PM
Sapphire