solution for chapter 1 exercise 6