Complete Exercise 1 in Chapter 15 of Think Python