Adding my solutions for Assignment 2

Adding the solutions for both functions for assignment 2