codes to solve http://www.pythonchallenge.com/