# Jupyter Notebook

CS Jupyter Lab Server is aviable at [https://djnb.cs.uwindsor.ca/](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:
    
    <div _ngcontent-ng-c2350534351="" class="code-block ng-tns-c2350534351-45 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahcKEwiEn5-epquXAxUAAAAAHQAAAAAQcA" decode-data-ved="1" jslog="223238;track:impression,attention;BardVeMetadataKey:W1sicl8zNjExYWMzZjQ3ZWM4NGJmIiwiY19lMTY4MmJjYWUxOGQ1NmM0IixudWxsLCJyY180ZGY1OGUyM2Q4NGQzNjljIixudWxsLG51bGwsImVuIixudWxsLDEsbnVsbCxudWxsLDEsMF1d"><div _ngcontent-ng-c2350534351="" class="formatted-code-block-internal-container ng-tns-c2350534351-45"><div _ngcontent-ng-c2350534351="" class="animated-opacity ng-tns-c2350534351-45"><div _ngcontent-ng-c2350534351="" class="code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2350534351-45 ng-star-inserted"><span class="ng-tns-c2350534351-45">Python</span><div _ngcontent-ng-c2350534351="" class="buttons ng-tns-c2350534351-45 ng-star-inserted"><button aria-label="Download code" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button><button aria-label="Copy code" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button></div></div></div></div></div>```
    print("Hello, Jupyter!")
    
    ```
    
    <div _ngcontent-ng-c2350534351="" class="code-block ng-tns-c2350534351-45 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahcKEwiEn5-epquXAxUAAAAAHQAAAAAQcA" decode-data-ved="1" jslog="223238;track:impression,attention;BardVeMetadataKey:W1sicl8zNjExYWMzZjQ3ZWM4NGJmIiwiY19lMTY4MmJjYWUxOGQ1NmM0IixudWxsLCJyY180ZGY1OGUyM2Q4NGQzNjljIixudWxsLG51bGwsImVuIixudWxsLDEsbnVsbCxudWxsLDEsMF1d"><div _ngcontent-ng-c2350534351="" class="formatted-code-block-internal-container ng-tns-c2350534351-45"><div _ngcontent-ng-c2350534351="" class="animated-opacity ng-tns-c2350534351-45"></div></div></div>
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:
    
    <div _ngcontent-ng-c2350534351="" class="code-block ng-tns-c2350534351-46 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahcKEwiEn5-epquXAxUAAAAAHQAAAAAQcQ" decode-data-ved="1" jslog="223238;track:impression,attention;BardVeMetadataKey:W1sicl8zNjExYWMzZjQ3ZWM4NGJmIiwiY19lMTY4MmJjYWUxOGQ1NmM0IixudWxsLCJyY180ZGY1OGUyM2Q4NGQzNjljIixudWxsLG51bGwsImVuIixudWxsLDEsbnVsbCxudWxsLDEsMF1d"><div _ngcontent-ng-c2350534351="" class="formatted-code-block-internal-container ng-tns-c2350534351-46"><div _ngcontent-ng-c2350534351="" class="animated-opacity ng-tns-c2350534351-46"><div _ngcontent-ng-c2350534351="" class="code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2350534351-46 ng-star-inserted"><span class="ng-tns-c2350534351-46">Markdown</span><div _ngcontent-ng-c2350534351="" class="buttons ng-tns-c2350534351-46 ng-star-inserted"><button aria-label="Download code" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button><button aria-label="Copy code" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button></div></div></div></div></div>```
    # My Notes
    This is a **bold** explanation of my code workflow.
    
    ```
    
    <div _ngcontent-ng-c2350534351="" class="code-block ng-tns-c2350534351-46 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahcKEwiEn5-epquXAxUAAAAAHQAAAAAQcQ" decode-data-ved="1" jslog="223238;track:impression,attention;BardVeMetadataKey:W1sicl8zNjExYWMzZjQ3ZWM4NGJmIiwiY19lMTY4MmJjYWUxOGQ1NmM0IixudWxsLCJyY180ZGY1OGUyM2Q4NGQzNjljIixudWxsLG51bGwsImVuIixudWxsLDEsbnVsbCxudWxsLDEsMF1d"><div _ngcontent-ng-c2350534351="" class="formatted-code-block-internal-container ng-tns-c2350534351-46"><div _ngcontent-ng-c2350534351="" class="animated-opacity ng-tns-c2350534351-46"></div></div></div>
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.