exercise 38 from learning pyhton the hard way