Python Problem 7

Problem returns correct answer in 0.171999931335s.