Solve problem 61 using Python.