HW4 problem 1 python