Exercise 172, user-made functions, complete