Notebook Exercises

Notebook UI

Part 1

Create a new Notebook and create a couple of cells that contain simple Python expressions.

Practice shifting between command and edit mode a few times, going back to edit existing cells.

Try using time.sleep(2) and watch the kernel activity indicator.


In [ ]:
from time import sleep
sleep(2)

Part 2

Go back to that last Notebook and add at least one of each cell type. Practice the following cell operations:

  • Moving up/down
  • Cut/Copy/Paste
  • Merge/Split

In [ ]:

Part 3

Go back to that last Notebook and repeat some of those cell operations using keyboard shortcuts:

  • Inserting cells above/below
  • Delete cell
  • Move cell up/down
  • Cut/copy/paste cell
  • Changing cell types

In [ ]:

External code

Go to the Matplotlib gallery, view the raw Python code for an example, use %load to load it into a cell and then run it. Make sure you run:

%matplotlib inline

first to enable plotting support.

If you don't have matplotlib installed, find any other simple python script online (or on your local drive), load it and execute it locally.


In [ ]:
%load soln/load.py

Restarting the kernel

Define a variable in a Notebook, then use the "Kernel:Restart" menu item to restart the Kernel and verify that the variable has been cleared.

Typesetting equations

Go to the MathJax website and copy an example equations. Paste it into a Markdown cell and verify it gets rendered correctly. Then try some LaTeX of your own.