HW1 problem 7 solved