Python Code for Chapter Examples