liveBook · Manning

Computational notebook

As explained in The Quick Python Book, Fourth Edition

Jupyter Notebook is an interactive computational document format and web application that combines executable code, results, and explanatory text.

A computational notebook combines executable code, its results, and explanatory Markdown text in an interactive document accessed through a web interface. It supports teaching, data exploration, data science, and AI experimentation. section 2.1.4

A Jupyter notebook organizes work into two cell types:

  • Text cells contain editable, formattable Markdown. section 2.3
  • Code cells contain executable Python and display output directly below the cell. section 2.3
  • Run a focused code cell with Ctrl-Enter, a context-menu command, or the play control. section 2.3
  • Review errors beneath the cell; Colaboratory may offer an automatic fix, which requires checking before acceptance. section 2.3.2

A first executable cell

Enter print("Hello, World") in a code cell and run it. The output, Hello, World, appears immediately below the cell. section 2.3.1

Inspecting a syntax error

Running print("Hello, World!" without its closing parenthesis produces an error below the cell. Python identifies the line, marks the location with a caret, and reports SyntaxError: incomplete input. section 2.3.2

print("Hello, World")                           #1
      
Hello, World                                    #2
#1 Code entered in code cell
#2 Output from running code, below code cell

Use the compact listing to distinguish code entered in a cell from the output produced beneath it. section 2.3.1

How The Quick Python Book, Fourth Edition covers it

How deep it goes
Explains cell types, Markdown, execution controls, output, and error display, but does not descend into notebook internals.
Examples
Demonstrates Hello World output, a missing parenthesis, cell controls, and a GitHub-hosted Chapter_02.ipynb notebook.
What it assumes
Assumes no GitHub knowledge for opening source notebooks and teaches cell types, execution, and output directly.
What you can do after
Operate/configure it to edit Markdown, run Python cells, read outputs, and inspect or cautiously apply suggested error fixes.
How it connects
Connects Python execution with Markdown, IPython, Google Colaboratory, and GitHub-hosted notebooks.

Also explained in

Compare how 4 books explain computational notebook →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Quick Python Book, Fourth Edition. The section links point to the parts of the book it draws on.