Week 3 assignment for https://www.coursera.org/course/progfun