Completed ex41.py