Do problem 14 with Python.