+ 1
Problem
I have some understanding problem with for loops ..please anyone explain and give me about that....
3 Respuestas
+ 3
What don't you understand in 'for' loops?
'some' isn't enough accurate ^^
+ 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.
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.