finished assignment 1 problem 6