Lab tutorial workbook: Using Jupyter Notebook for Python:
**Lab Tutorial Workbook: Introduction to Jupyter Notebook**
**1. Installing Jupyter Notebook**
- Start by installing Python on your machine if you haven't already. You can download Python from the official Python website.
- Once Python is installed, open your command prompt or terminal and run the following command to install Jupyter Notebook:
pip install jupyterlab
**2. Launching Jupyter Notebook**
- Open your command prompt or terminal and navigate to the desired directory where you want to create your notebook.
- Run the following command to launch Jupyter Notebook:
- This will open Jupyter Notebook in your default web browser.
**3. Creating a New Notebook**
- In the Jupyter Notebook interface, click on the "New" drop-down menu on the right side and select "Python" to create a new Python notebook.
- A new tab will open with an empty notebook.
**4. Notebook Cells**
- A Jupyter Notebook is made up of cells, which can contain code, text, or visualizations.
- By default, the first cell is a code cell. You can write Python code in it.
- To add a new cell, click on the "+" button in the toolbar or press the "B" key on your keyboard while in command mode (press "Esc" to activate command mode).
- To change the cell type, select the cell and go to the toolbar and select either "Code" or "Markdown" from the drop-down menu.
**5. Running Code**
- To run a code cell, select the cell and press "Shift + Enter" or click the "Run" button in the toolbar.
- Output from the code will appear below the cell.
- You can also use shortcuts like "Ctrl + Enter" to run the cell and stay on the same cell.
**6. Editing and Formatting Text**
- To add text to a notebook, create a markdown cell.
- Double click on a markdown cell to edit its contents.
- You can use Markdown syntax to format your text. For example:
- To create headers, use "#" (e.g., "# Heading 1").
- To create bullet points, use "-" or "*" (e.g., "- Item 1").
**7. Saving and Exporting Notebooks**
- To save your notebook, go to "File" and click on "Save and Checkpoint" or use the shortcut "Ctrl + S".
- To export your notebook, go to "File", select "Download As", and choose the desired format (e.g., "Notebook (.ipynb)", "Python (.py)").
**8. Restarting and Clearing Output**
- To restart the Python kernel (clear all variables and reset the notebook), go to "Kernel" and click on "Restart" or use the shortcut "0, 0" (press "0" twice).
- To clear the output of a cell, select the cell and go to "Cell" and click on "Clear Output" or use the shortcut "Shift + O".
**9. Additional Resources**
- Jupyter Notebook documentation: [https://jupyter-notebook.readthedocs.io/](https://jupyter-notebook.readthedocs.io/)
- Jupyter Notebook tutorials: [https://www.datacamp.com/community/tutorials/tutorial-jupyter-notebook](https://www.datacamp.com/community/tutorials/tutorial-jupyter-notebook)
This lab tutorial workbook provides a basic introduction to Jupyter Notebook for Python. Explore the capabilities of Jupyter Notebook further to unlock its full potential for data analysis, visualization, and more. Happy coding!