Completing assignments

In this course we will use JupyterLab to complete assignments. JupyterLab is a free, interactive development environment (IDE) which runs in your web browser.

Launch JupyterLab

Launch JupyterLab by clicking this button: Binder

It takes a minute to spin-up but eventually you will see a new JupyterLab environment.

The JupyterLab interface consists of different components such as a file browser, terminal, console, text editor, etc. The main JupyterLab component we will use during this course is Jupyter Notebook (with .ipynb extension) which can contain computer code and rich text elements (headings, lists, figures, links, etc.). Jupyter Notebooks are great for sharing code between instructor and students, executing code, and completing assignments.

Start assignment

Open a new notebook

By clicking the Python 3 (ipykernel) panel under notebook.

jupyterlab

Check everything is working

Copy and paste the code below into the first cell of your Jupyter Notebook.

import numpy as np
c = np.add(2,3)
c
5

Run the cells by pressing Shift + Enter. If everything is working correctly, this code block should return the number 5.

Note

If you are using cloud-based computing environments (i.e. Binder) to complete weekly assignments, they can be accessed from anywhere with any computer as long as you have a good internet connection.

Save assignment

Save the notebook by clicking File –> Save Notebook As… and naming the file something like assignment-x.ipynb, where x stands for the assignment number.

Warning

Regularly download a copy of your work! The cloud computing environments are temporary and Python3 kernel will automatically shut down after 10 minutes of inactivity (if you leave a jupyterlab window open in the foreground, this will generally be counted as “activity”).

Tip

If you have a short period of inactivity, the kernel can be restarted by clicking No Kernel in the top right and selecting Python 3 (ipykernel).

Submit assignment

This can be a little tricky. We recommend using ctrl + p (or command + p) → Save as PDF. You could also download the notebook by clicking File –> Save and Export Notebook As –> PDF but you may need to install some other packages.

When you are finished with the assignment, the .pdf file should be moved to your local course folder and submitted via Canvas.

JupyterLab

These instructions are just the absolute basics. For more information about JupyterLab, we suggest referring to their docs. The following pages are particularly relevant: