IPython notebook is great for:
Sharing code!
Combining code with text, plots, mathematical expressions, videos, images, and more!
Show-off a bit!
Interactive teaching (live code)
And.. It has great features such as:
tab-completion
syntax highlighting
%-prefixed commands
Many more...
Check out Ipython notebook here: http://ipython.org/notebook.html
In [ ]:
<iframe src=http://ipython.org/notebook.html width=1000 height=400></iframe>
You can write text in markdown too!
Check out some markdown basics here: http://nbviewer.ipython.org/url/www.astro.washington.edu/users/vanderplas/Astr599/notebooks/Markdown%20Cells.ipynb!
This code finds the factorial of a series of number in one line:
In [8]:
#this is a terrible and awesome way to do this:
factorial = (lambda k: reduce(int.__mul__, range(1,k+1),1))
In [25]:
map(factorial, range(1,9))
Out[25]:
This shows the use of builtin timeit magic using the following %-prefix command:
In [2]:
import random
%timeit a = [random.random() for x in range(1000)]
The builtin magics include:
Functions that work with code: %run, %edit, etc.
Functions to run code in other languages: %%bash %%perl %%ruby %%javascript, etc.
*See some examples with magic functions here: http://nbviewer.ipython.org/github/ipython/ipython/blob/1.x/examples/notebooks/Cell%20Magics.ipynb.
You can display images stored locally like this:
In [1]:
from IPython.display import display, Image
display(Image(filename='misc-you-dont-say-l.png'))
Or images stored on the web like this:
In [ ]:
<img src="http://cdn.alltheragefaces.com/img/faces/large/misc-you-dont-say-l.png" width=300 height=300/>