Learning generators part 2: In depth

How generators can be used in four ways (from simple to complex):