Solutions to pythonchallenge.com 1 through 4