Python is a very popular general-purpose language, with all the modern and classic constructs of a programming language that every software developer appreciates.
IPython notebooks are very interesting novel features added as an overlay to python. Notebooks are interactive documents that allow running Python code and reading (or writing) notes and documentations in the same place. Therefore, one can not only see the results he is reading about, but also can produce different results by changing the documented code. A notebook is actually an extended HTML file which contains specific markup to distinguish Python codes inside the page. When displayed using a custom web server, it allows interactive execution and editing of the code inside the document. However, it can also be viewed as a usual, nicely-formatted HTML page.
In this tutorial, we show you how to install IPython Notebooks, use sample notebooks and even prepare slides with them! This is a shorter version of the tutorial given at EPFL as a workshop on "Reproducible Research using IPython interactive publications". The workshop materials are available here.
Detailed instructions on how to install both python and IPython Notebooks are provided here.
The command to run the IPython Notebooks is the following:
$ ipython notebook
When you execute the command above, a new browser window is opened which shows the notebooks in the current folder. You should see something like this in your browser:
The IPython notebook files have the ".ipynb" extension.
You can create a notebook by clicking on the "New Notebook" button in the browser launched by typing the above command. In the notebook, you will work with "cells" (see below).
In each cell, you can either type code, mark down comments or raw text, depending on the cell type you can choose from the dropdown menu above the cell, as highlighted in the image above.
You can then click on the "play" button to run the code within each cell or simply render the markdown comments you have written. An example is given below:
IPython Notebooks are quite powerful tools. You can do wonders with them! A few sample notebooks are provided here that you can use and get started. Most notably is this one which shows how you can do computations with the notebooks, integrate images and videos within them or even embed webpages inside your notebook.