Problem 25 Solution - Python