add result function to opti_HW4_q2.py and update result_q2.txt