Python Code for Coursera course