Adding solution to homework 2 week 3