python solutions for problem 1, 2, and 5

This is too mathy!