Solved Week 4 programming assignment