exercise 36 from learning pyhton the hard way