Solution to Week 1 Programming Assignment