Skip to main content
Jupyter notebooks are one of the most important tools in the Python data and AI ecosystem. Instead of writing a script and running the whole thing at once, notebooks let you break your code into individual cells and execute them one by one. You see the output — including charts, tables, and formatted text — inline, right below each cell. This makes notebooks ideal for exploring data, building models step by step, and documenting your thinking alongside your code.

What is a .ipynb file?

A .ipynb file (IPython Notebook) is a JSON document that stores a sequence of cells. Each cell can contain either Python code or Markdown text. When you run a code cell, the output is captured and saved directly in the file alongside the code that produced it. This structure makes notebooks great for:
  • Learning — see what each line does immediately
  • Experimentation — try an idea, see the result, adjust and try again
  • Documentation — mix explanations with runnable code
  • Data analysis — display DataFrames, charts, and statistics inline

Notebook environments compared

There are several places you can run Jupyter notebooks. Here is a quick comparison: For this course, you will primarily use VS Code Notebooks, since they keep your notebooks and Python files in the same workspace.

Creating a notebook in VS Code

To use notebooks in VS Code you need the Python and Jupyter extensions installed (covered in the Setup page), plus the ipykernel package in your active environment.
1

Install notebook support

Open the VS Code terminal and run:
2

Create a new notebook

Use either of these methods:Option A — File menu:
Option B — Command Palette: Press Ctrl/Cmd + Shift + P, then search for:
3

Select a kernel

Click Select Kernel in the top-right corner of the notebook and choose the Python interpreter from your virtual environment.
4

Run your first cell

Click in the first cell, type a Python expression, and press Shift + Enter to run it.

Running code in notebooks

Notebooks support two types of cells: Code cells — contain Python (or shell commands with !):
Shell commands — prefix with ! to run operating system commands:
Package installation — use %pip (not pip) inside notebooks:
Using %pip install inside a notebook is preferred over !pip install because %pip ensures the package is installed into the same Python environment the notebook kernel is using.

Essential keyboard shortcuts

Notebooks have two modes: Edit mode (you are typing inside a cell) and Command mode (you are navigating between cells). Press Esc to enter Command mode and Enter to return to Edit mode.

Google Colab

If you need to run a notebook without a local setup — or want free GPU access for AI experiments — Google Colab is a solid option. It is a cloud-hosted Jupyter environment that requires only a Google account. Visit colab.research.google.com or go directly to colab.new to open a blank notebook instantly. Install packages for the current Colab session:
All practice notebooks in this course are available as Colab links, so you can run them in your browser if you prefer not to set up a local environment right away.

JupyterLab (standalone alternative)

If you prefer working in a browser-based interface dedicated entirely to notebooks, JupyterLab is the modern upgrade to the classic Jupyter Notebook app.
JupyterLab includes a file explorer, the ability to open multiple notebooks side by side, a built-in terminal, and a text editor — all in one browser tab. It is a strong choice for data science workflows that revolve around notebooks.
When working locally with JupyterLab or Jupyter Notebook, always launch the server from inside your project’s virtual environment so the kernel has access to your installed packages.