exercise of python cookbook