iterables python code example
Example 1: what does iterable mean
#An iterable is any Python object capable of returning its members one at a time, permitting it to be iterated over in a for-loop. Familiar examples of iterables include lists, tuples, and strings - any such sequence can be iterated over in a for-loop.
Example 2: how to use iteration in python
for i = 1 to 10
<loop body>
Example 3: python iterator
pies = ["cherry", "apple", "pumpkin", "pecan"]
iterator = iter(pies)
print(next(iterator))
#prints "cherry" because it's the current one being iterated over
Example 4: how to use iteration in python
n = 5
while n > 0:
print n
n = n-1
print 'Blastoff!'