Finished Python solutions to problems 2 and 3.