Infinite random number generator
This example was created to show that iterators (generators) don't necessarily return a fixed list of values.
import random
def miranda():
while True:
yield random.random()
total = 0
for val in miranda():
print(val)
total += val
if total > 10:
break
Output: