Complete Exercise 1 in Chapter 4, Section 3 of Think Python