This is my code for my chapter 3 exercises