Simple exercise using generators