Solution for week03 assignment