Jupyter notebooks are interactive documents that let you combine code, text, images, and even graphs, all in one place. They're especially useful for beginners because you can run code step by step and see the results immediately, without worrying about complicated setups. Here are three easy ways to get started:
What you need:
- Python installed on your computer
- Visual Studio Code (VS Code), which you can download from https://code.visualstudio.com
Here’s how to set it up:
- Open Visual Studio Code.
- Look at the left sidebar and click the icon shaped like four small squares—this is the Extensions panel.
- In the search bar, type "Python" and click on the one from Microsoft to install it. (This connects VS Code with Python on your computer.)
- Next, search for "Jupyter" and install it as well. (This lets you run interactive notebooks.)
- Now, create your notebook:
- Go to File → New File, then save your new file with a name ending in
.ipynb. For example, you could call itmy_notebook.ipynb. This tells VS Code it’s specifically a notebook file.
- Go to File → New File, then save your new file with a name ending in
- You can now write code in small blocks called cells. To run each cell, click the "play" button (▶).next to it.
You’ll immediately see results below the code.
What you need:
- Python installed on your computer
Here’s how you set up a local Jupyter notebook:
- Open your computer’s terminal (on Windows: Command Prompt or PowerShell; on Mac/Linux: Terminal).
- Install Jupyter with this simple command (it’s safe to copy-paste):
pip install notebookThis tells Python to install Jupyter for you.
- Once installed, navigate to the folder containing your notebook (or where you want it to be) in the terminal, then type:
jupyter notebook- After you press Enter, a browser window will open automatically at
http://localhost:8888. (This address just means your notebook runs locally, directly on your own computer.) - The web page you see is the Jupyter notebook interface. Here, click on an existing
.ipynbfile to open it, or create a new notebook by clicking New → Python 3. - Write your code in cells. To run a cell, click the "play" button (▶).
What you need:
- A Google account
- A web browser with internet access (no other installation)
- Go to https://colab.research.google.com.
- To create a notebook from scratch, simply click on File → New Notebook.
- If you already have a notebook file (
.ipynb), choose File → Upload notebook and pick the file from your computer. - In Colab, each code cell has a small "play" button (▶). Click it, or press Shift + Enter on your keyboard, and your code runs immediately.
Google Colab automatically saves all your work into your Google Drive, so you don't have to worry about losing it.
A special benefit of Colab: It gives you free access to powerful hardware (GPUs or TPUs), especially useful for machine learning tasks (but you don’t need to worry about that yet unless you want to explore advanced topics).