HW 8 2. exercise solved.