Solves Problem 49 in Python