Added an iteration version of the exercise