Do problem 15 in Python.