solution for the assignment 2