This page was generated from `source/notebooks/Intro/NotebookEditor.ipynb`_.
Notebook editor¶
A Jupyter Notebook provides an interface with essentially two modes
edit mode the mode where you edit a cells content.
command mode the mode where you execute the cells content.
In the more advanced version of JupyterLab, which we are using on myBinder, this will look like that
Edit mode¶
Edit mode is indicated by a blue cell border and a prompt showing in the editor area:
When a cell is in edit mode, you can type into the cell, like a normal text editor.
Command mode¶
Command mode is indicated by a grey cell border:
Running code¶
Code cells allow you to enter and run code. Run a code cell by pressing the ▶︎
button in the bottom-right panel, or Control
+Enter
on your hardware keyboard.
[1]:
v = 10
[5]:
print(v)
100
There are a couple of keyboard shortcuts for running code:
Control
+Enter
run the current cell and enters command mode.Shift
+Enter
runs the current cell and moves selection to the one below.Option
+Enter
runs the current cell and inserts a new one below.
Managing the kernel¶
Code is run in a separate process called the kernel, which can be interrupted or restarted. You can see kernel indicator in the top-right corner reporting current kernel state: ⚪︎
means kernel is ready to execute code, and ⚫︎
means kernel is currently busy. Tapping kernel indicator will open kernel menu, where you can reconnect, interrupt or restart kernel.
Try running the following cell — kernel indicator will switch from ⚪︎
to ⚫︎
, i.e. reporting kernel as “busy”. This means that you won’t be able to run any new cells until current execution finishes, or until kernel is interrupted. You can then go to kernel menu by tapping the kernel indicator and select “Interrupt”.