Completed ex7.py