Python Programming from First Principles: Learn to Code, Think Computationally, and Solve Real-World Problems
PDFEPUB
CHAPTER GUIDE · GETTING STARTED

Jupyter Notebook

On this pageOpen Jupyter NotebookCreate, run and save a notebookContinue with the book

Choose this route if you want to work through the book’s companion notebooks. A notebook keeps code cells, explanations and output in a document saved with the .ipynb extension. If you prefer saved .py files, continue to VS Code instead.

Open Jupyter Notebook

After completing your platform’s verification, open Anaconda Prompt on Windows or a terminal configured for conda on macOS/Linux. Activate the environment you verified, then start Notebook:

conda activate base
jupyter notebook
Listing 20 — Start Jupyter Notebook in the selected Anaconda environment.

The command starts a local server and normally opens a browser. If the browser does not open, use the complete local address printed in the terminal. Keep that terminal running while you work. If the command is unavailable, consult the Jupyter (software for working with documents that combine code, text and output) installation instructions1 for the selected environment.

The notebook file browser shown in the original book's Jupyter screenshot.
Figure 4 — The notebook file browser. This original book screenshot shows an older interface; current menus may differ.

Create, run and save a notebook

Create a notebook and choose a Python kernel when prompted. The kernel executes the code in its cells. Enter the following instruction in a code cell, then press Shift+Enter. The output below the cell should read Notebook ready.

print("Notebook ready")
Listing 21 — Run one instruction in a notebook cell.
An original book screenshot showing a Python code cell and its printed output in Jupyter Notebook.
Figure 5 — A code cell with its output. The original screenshot uses Hello World; your Notebook ready message follows the same cell-execution process.

Give the notebook a meaningful name and use the application’s save command. Saving preserves the document; running a cell executes that cell. They are separate actions. When reopening a notebook, run its cells in order so that later cells can use values created earlier.

Continue with the book

You can now use the companion notebook linked from Your first Python programs. You do not need to complete the VS Code (Visual Studio Code, an application for writing and organising program files) setup to follow that route.

See the Jupyter Notebook documentation2 for current interface details.


  1. Jupyter installation instructions.↩︎

  2. Jupyter Notebook documentation.↩︎