this is exercise 6 from the end of the precourse