Adding answer for exercise 3.5