my solution to assignment 1