code for page 17 / exercise 1