Completed problem3.py