converted Chapter 1 script to iPython Notebook