Jupyter Notebook
With Jupyter Notebook, you can run code in small sections and see the results as you go. Code, explanations, tables, and charts can all live in one interactive document.
Also known as: Jupyter
What is Jupyter Notebook?
Jupyter Notebook is a browser-based application for creating and running interactive documents called notebooks. Instead of sending someone a script and a screenshot of its output, you can give them one document that shows what you did, why you did it, and what the code produced. They can read the results as saved or rerun the code with different inputs.
Cells, kernels, and files
A notebook is divided into cells. Markdown cells hold explanations, headings, and equations. Code cells run on demand, with their output displayed below them. That output might be a number, a table, an error message, or a chart.
The browser is the interface, not the program that runs the code. When you execute a code cell, Jupyter sends it to a kernel, a process that runs the code and returns the result. The kernel may run on your laptop or on a remote machine. Python is a common choice, but Jupyter can also work with other languages through kernels such as those for R and Julia.
An .ipynb file stores the cells, metadata, and any saved outputs. It does not store the kernel's live variables or imports. That's why a chart can still be visible when you reopen a notebook even though the current kernel has not run the code that created it. JupyterLab is another interface that opens the same notebook format.
Example: Why run order matters
Suppose one Python cell contains:
price = 20
quantity = 3
A second cell shows the total:
price * quantity # 60
If you edit quantity to 5 but run only the second cell, the answer is still 60: the kernel is using the last value it actually received. Run both cells in order and you get 100. Restart the kernel and run only the second cell, and Python raises NameError because the variables no longer exist. Cells are easy to run separately, but they are not isolated from one another.
When to use one
Notebooks work well for exploring a dataset, comparing model results, teaching, and writing reports that show the calculations behind a conclusion. If a prototype becomes a scheduled job, move reusable logic into tested modules so it can run without relying on someone clicking cells in the right order. The notebook can still explain the analysis and call those modules.
Before sharing, restart the kernel and run all cells from top to bottom. This catches dependencies on leftover state, but it does not guarantee the notebook will run on another machine. Record the package versions and tell readers how to obtain the inputs. Check saved outputs for credentials or sensitive records as well as checking the code itself.
In an interview
In a data analyst or data science interview, you might be shown a notebook with a result on screen that fails on a fresh run. Explain the distinction between saved output and live kernel state, then describe how you'd verify the result from a clean start.