Completed problem 16 (016.py)