Using Jupyter Notebooks

A few of your lesson resources come as Jupyter Notebooks — files ending in .ipynb — instead of a plain Python file. They're not hard to use, but the first one can be confusing if nobody's shown you the two or three things that are different. This page is that explanation, once, so you're not re-learning it every time.

What's Different About a Notebook

A regular .py file is just code, top to bottom, and you run the whole thing at once. A notebook is broken into cells — some hold code, some hold formatted text like this page — and you run cells one at a time, in whatever order you want. That's what makes them good for explanations: text and code can sit right next to each other.

Opening One

  1. Find the .ipynb file (usually linked from a lesson page) and open it in VS Code
  2. First time only: VS Code may ask you to select a kernel — choose the Python option (it'll usually just say something like "Python 3.x.x")
  3. If VS Code prompts you to install the Jupyter extension, say yes — same idea as the Python extension prompt from Day 1

Running a Cell

  • Click into a cell, then press Shift+Enter to run it and move to the next one (or Ctrl+Enter to run it and stay put)
  • Or hover over the cell and click the ▶ button that appears on its left
  • Output shows up directly underneath the cell you ran

A Couple of Things to Know

  • Cells can be run in any order, and out of order — if something seems off, that's usually why. Use Restart Kernel and Run All (in the toolbar at the top) to run everything fresh, top to bottom, in the order it's written.
  • Editing a cell doesn't break anything permanently — change it, run it again, see what happens.
  • Nothing here submits or saves to anyone but you unless a lesson tells you otherwise.

That's genuinely it. If a lesson links you a notebook: open it, read the text cells, run the code cells with Shift+Enter, and you're using Jupyter.