Skip to main content

Jupyter Notebook

CS Jupyter Lab Server is aviable at https://djnb.cs.uwindsor.ca/

Understand Notebook Cells

A Jupyter Notebook is made up of individual blocks called cells. The two primary cell types you will use are:

  • Code Cells: Used to write and execute programming logic (default is Python). Outputs appear directly below the cell.

  • Markdown Cells: Used to write formatted narrative text, explanations, headings, and bullet points using Markdown syntax.

  • Verification: Click the cell dropdown menu in the toolbar to toggle any cell between "Code" and "Markdown".

  1. Click on the first empty cell (which defaults to a code cell).

  2. Type a simple print statement:

    Python
    print("Hello, Jupyter!")
    
  3. Run the cell by pressing Shift + Enter on your keyboard (or clicking the Play ▶ button in the toolbar).

  • Verification: Confirm that the text Hello, Jupyter! appears directly underneath the code cell.

Add Text Using Markdown

  1. Insert a new cell below by clicking the + button in the toolbar or pressing B while in command mode.

  2. Change the cell type to Markdown.

  3. Type some formatted text:

    Markdown
    # My Notes
    This is a **bold** explanation of my code workflow.
    
  4. Press Shift + Enter to render the text.

  • Verification: Check that the Markdown code converts into a clean heading and bold text instead of raw code.

Essential Keyboard Shortcuts

Jupyter operates in two modes: Edit Mode (typing inside a cell, green border) and Command Mode (navigating cells, blue border). Press Esc to enter command mode, and Enter to edit.

  • Shift + Enter: Run current cell and move to the next.

  • A: Insert a new cell above the current cell.

  • B: Insert a new cell below the current cell.

  • M: Change active cell to Markdown.

  • Y: Change active cell to Code.