Setting Up Google Colab

No installs, no setup headaches. Google Colab lets you write and run Python straight from your browser โ€” this is the fastest way to start coding for this course.

What is Google Colab?

Google Colaboratory (Colab) is a free, cloud-hosted Jupyter notebook environment. It runs entirely in your browser, requires zero installation, and comes with Python already set up โ€” including popular libraries like numpy, pandas, and matplotlib. Your notebooks are saved directly to your Google Drive.

All you need is a Google account and a browser. It works on Windows, Mac, Linux, and even Chromebooks.

Step-by-Step Setup

  1. Open Google Colab Go to colab.research.google.com in your browser and sign in with your Google account.
  2. Create a new notebook Click File โ†’ New notebook (or hit "New Notebook" on the welcome screen). A blank notebook opens with one empty code cell.
  3. Rename your notebook Click the title at the top left (default: Untitled0.ipynb) and give it a meaningful name, e.g. day1_print_function.ipynb.
  4. Write your first line of code Click inside the first cell and type print("Hello, Colab!").
  5. Run the cell Press Shift + Enter (or click the โ–ถ play button on the left of the cell) to execute it. The output appears right below the cell.
  6. Add more cells Use + Code at the top (or hover below a cell) to add new code cells. Use + Text to add notes/markdown between code blocks.
  7. Save your work Colab autosaves to Google Drive under a folder called Colab Notebooks. You can also force-save with Ctrl/Cmd + S.

Running Your First Program

Type this into a cell and run it with Shift + Enter:

print("Hello, World!")
print("Welcome to Python with Dutta")
# -> Hello, World!
# -> Welcome to Python with Dutta

Useful Colab Shortcuts

ActionShortcut
Run current cellShift + Enter
Run cell and insert new one belowAlt + Enter
Add a code cell belowCtrl/Cmd + M B
Delete current cellCtrl/Cmd + M D
Save notebookCtrl/Cmd + S

Installing Extra Packages

Most libraries you'll need are pre-installed. If you ever need one that isn't, install it directly from a code cell using !pip:

!pip install some-package

The ! tells Colab to run the command as a shell command instead of Python code.

Things to Remember

Quick Revision

Google Colab is a free, browser-based Python environment โ€” go to colab.research.google.com, sign in with your Google account, create a new notebook, and start writing code in cells. Run a cell with Shift + Enter. Notebooks autosave to your Google Drive, and you can install any extra package with !pip install package-name.