my Assignment2 solution