Solution for week 1 assignment