HW3_prob3 completed