Completed ex17.py