code for http://www.pythonchallenge.com/