Completed hw4.py