Python 3.7.x Notes-2
Control Flow
1.for
>>> # Measure some strings:
... words = ['cat', 'window', 'defenestrate']
>>> for w in words:
... print(w, len(w))
...
cat 3
window 6
defenestrate 12
2.Range()
If you do need to iterate over a sequence of numbers, the built-in function range() comes in handy. It generates arithmetic progressions
>>> for i in range(5):
... print(i)
...
0
1
2
3
4
3.break, continue, else
The break statement, like in C, breaks out of the innermost enclosing for or while loop.
Loop statements may have an else clause; it is executed when the loop terminates through exhaustion of the list (with for) or when the condition becomes false (with while), but not when the loop is terminated by a brea