Skip to content

What is a Jupyter Notebook?

What is a Jupyter Notebook?

A Jupyter notebook is a type of document or electronic file which can contain both programming code and text descriptions. Jupyter notebooks can also contain embedded charts, plots, images, videos and links. Although Jupyter notebooks can contain code for many different programming languages, a lot of Jupyter notebooks contain Python code. The same type of Python code found in a .py file. The text description sections of Jupyter notebooks contain explanations and clarifications of the programming code in the markdown format. Markdown files have the extension .md. Markdown sections of a Jupyter notebook can include formatting to make text bold, italic, form tables and lists, show code listings and images.

One way to think of a Jupyter notebook is the combination of a .py file, a Python file, with a .md file, a markdown file. The Jupyter notebook file extension is .ipynb which stands for IPython Notebook. Jupyter notebooks still use the .ipynb extension even if they contain code from a different programming language such as R or Octave.

Jupyter notebooks function sort of halfway between the Python REPL and a Python module .py file. In the Python REPL, only one command can be typed at a time, and only one line of output is shown at a time. In a .py file, the entire file is run at one time, and the output of the entire file is produced at once. In a Jupyter notebook, chunks of code one line or many lines long can be run individually and in any order without running all of the code in the jupyter notebook.

Python .py files and markdown .md files are typically edited in a text editor like notepad. Jupyter notebooks run inside a web browser like Chrome or Firefox. Regular .py files only contain Python commands and comments. Jupyter notebooks contain two types of cells: code cells and markdown cells. Lines of Python code are run in code cells. Markdown cells contain text like descriptions of what will happens in subsequent code cells. The output from running the code cells is also shown in the Jupyter notebook. Charts, plots, command line output and images can all be shown in Jupyter notebooks as well.