adding a solution for the first exercises in chapter 3