problem set2 exercise2 working