############DO NOT EDIT THIS CELL############ from pylab import * switch_backend('WXAgg') ion() 1+1 2 foo=1 bar=2 baz= foo+bar print baz 3 Nbshell Tutorial
Basic Operations Nbshell allows you to create and edit IPython notebooks. A IPython notebook is a document which contains python code, formatted text and figures. The code is entered in input cells that look like this: A cell is executed when you put the cursor on it and press Shift-Enter. When you do that output is produced and is written after the cell. A single cell can consist of more than one line. If you press Enter while editing a cell a newline will be inserted at the place of the cursor. So you can have longer statements in a single cell like this: You can also write if statments, loops, class and function definitions in a cell. Please note that you cannot have a compound statement or a class definition spread across more than one cell. When the cell is executed its input and output is appended in a log and a number is assigned to it. Cells are always added at the end of a log, even if you edit an older cell. In that case the old cell is deleted from the log and a new one is added at the end. This is made so that you know the order in which the cells were executed - it corresponds to the order of the cell numbers. Also if you modify a cell and don't execute it its contents won't be added to the log and will be lost. Some operations, like adding and deleting blocks, require Nbshell to update the contents on the screen, and if you had a modified cell which had not been saved in the log, the modifications would be lost. Also if you modify more than one cell only the one you execute will be added to the log. This behavior is little annoying, I admit , and it will probably change in the future.