Solution for Week 2 Programming Assignment