Google Colab Instructions¶
Google Colab is a free notebook tool that runs in your web browser. It is a good option when you want to save a copy of your work in Google Drive.
When to Use Colab¶
Use Colab when:
- You want your notebook work saved in Google Drive.
- Binder is slow or unavailable.
- Your instructor asks you to submit a completed notebook file.
- You are already comfortable signing in with a Google account.
Binder is usually the easiest starting option. Colab is often better when saving work matters.
Option 1: Open a Notebook from GitHub¶
- Go to the course repository on GitHub.
- Open the
notebooks/folder. - Click the notebook you want to use.
- Copy the GitHub page URL from your browser.
- Open Google Colab.
- Select
File. - Select
Open notebook. - Select the
GitHubtab. - Paste the GitHub URL.
- Select the notebook and open it.
This option is useful because it starts from the official course notebook.
Option 2: Upload a Notebook File¶
- Download the notebook file from the course repository or learning system.
- Open Google Colab.
- Select
File. - Select
Upload notebook. - Choose the
.ipynbnotebook file from your computer. - Wait for the notebook to open.
This option is useful if your instructor gives you a notebook file directly.
How to Run Cells¶
- Start at the top of the notebook.
- Read the instructions before running code.
- Click the play button beside the first code cell.
- Wait for the output to appear below the cell.
- Continue one cell at a time.
- Complete each TODO or practice step when you reach it.
Run cells in order. Later cells may depend on variables or code from earlier cells.
Optional: Upload a Data File¶
The core notebooks do not require data files. If your instructor assigns an optional extension using a file from the course data/ folder, upload it as follows:
- In Colab, look for the folder icon on the left side of the page.
- Click the folder icon to open the file panel.
- Click the upload button.
- Choose the needed data file from your computer.
- Wait until the file appears in the file panel.
- Run the notebook cell that uses the file.
Uploaded files may disappear when the Colab runtime resets. If that happens, upload the file again.
How to Save Your Work¶
- Select
File. - Select
Save a copy in Drive. - Rename the copy if your instructor gives a required file name.
- Continue working in your saved copy.
- Before submitting, check that your latest changes are saved.
Saving a copy helps protect your work if the browser closes or the runtime resets.
Colab Tips¶
- If Colab asks for permission to run the notebook, choose the option to continue.
- If the runtime resets, run the notebook again from the top.
- If a variable is missing, rerun earlier cells in order.
- If a data file is missing, upload the file again.
- Save your work before closing the browser tab.