coursera dataSci assignment2 problem2 and 3