Do problem 17 with Python.