how to iterate through for loop in python code example
Example 1: how to create a break in iterating a sequence with a specific set of values in python
>>> d = {'foo': 1, 'bar': 2, 'baz': 3}
>>> for k, v in d.items():
... print('k =', k, ', v =', v)
...
k = foo , v = 1
k = bar , v = 2
k = baz , v = 3
Example 2: how to use iteration in python
n = 5
while n > 0:
print n
n = n-1
print 'Blastoff!'