Updated to complete homework

This commit is for code updated to complete Coursera homework.