Jupyter Notebook Tutorial PDF

Summary

This document is a tutorial on using Jupyter Notebook for Python programming. It covers the basics of creating, running, and managing Jupyter Notebooks, including code execution, markdown formatting, and various shortcuts.

Full Transcript

GOOD MORNING! WORD FOR THE DAY Laudable OUTLINE 4.1 INTRODUCTION TO JUPYTER NOTEBOOK 4.2 CREATING AND RUNNING PYTHON SCRIPTS IN JUPYTER NOTEBOOK 4.3 SHORTCUTS KEYS IN JUPYTER NOTEBOOK CHAPTER OBJECTIVES BY THE END OF THIS LESSON, STUDENTS WILL BE ABLE TO: 1. UNDERSTAND THE FUNDAMENTALS OF...

GOOD MORNING! WORD FOR THE DAY Laudable OUTLINE 4.1 INTRODUCTION TO JUPYTER NOTEBOOK 4.2 CREATING AND RUNNING PYTHON SCRIPTS IN JUPYTER NOTEBOOK 4.3 SHORTCUTS KEYS IN JUPYTER NOTEBOOK CHAPTER OBJECTIVES BY THE END OF THIS LESSON, STUDENTS WILL BE ABLE TO: 1. UNDERSTAND THE FUNDAMENTALS OF JUPYTER NOTEBOOK. 2. CREATE AND RUN PYTHON SCRIPTS. 3. USE AND MASTER JUPYTER NOTEBOOK SHORTCUTS 4.1 INTRODUCTION TO JUPYTER NOTEBOOK Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It is widely used in various fields, including data analysis, scientific research, machine learning, and education. Jupyter Notebook supports multiple programming languages, but it is most commonly associated with Python. 4.1 INTRODUCTION TO JUPYTER NOTEBOOK Jupyter Notebook Homepage Jupyter Notebook Interface 4.1 INTRODUCTION TO JUPYTER NOTEBOOK One of Jupyter Notebook's distinctive features is its ability to weave code with explanations. Markdown cells enable you to provide context, instructions, and insights alongside your code. This unique blend of code and commentary fosters a deeper understanding of your programming decisions, making your notebooks not just functional, but educational and communicative. 4.2 CREATING AND RUNNING PYTHON SCRIPTS IN JUPYTER NOTEBOOK Within Jupyter Notebook introduces a new dimension to your coding experience. Jupyter Notebook's interactive environment allows you to break down your code into manageable cells, execute them individually or in sequence, and visualize the output instantly. Let's explore the process of creating and running Python scripts in Jupyter Notebook: 1. CREATING A NEW NOTEBOOK 1. Launch Jupyter Notebook by opening your terminal or command prompt and typing `jupyter notebook`. 2. In the Jupyter interface that opens in your web browser, click the "New" button and select "Python 3" to create a new notebook. 2. ADDING/WRITING CODE 1. Jupyter Notebook presents you with an empty cell, ready to accept your code. Click on the cell to start typing or pasting your Python code. 2. Write or paste your code into the cell. 3. EXECUTING CODE 1. To execute the code in the cell, press Shift + Enter. The output of the last line of code will be displayed below the cell. In this case, the string “Hello World!” Runing and displaying the output will be displayed. 4. ADDING COMMENTS AND MARKDOWN 1. You can also add comments and explanatory text to your notebook. 2. To add Markdown text, change the cell type to "Markdown" using the dropdown menu at the top of the notebook. Then, you can write your explanations, headers, and formatting using Markdown syntax. 4. ADDING COMMENTS AND MARKDOWN Adding Comments and Markdown 5. MANAGING CELLS 1. You can add new cells using the "+" button in the toolbar. Cells can be set to "Code" or "Markdown" types. 2. To reorder cells, use the up and down arrows in the toolbar, or press A (above) or B (below) in command mode. 3. To delete a cell, select it and press D twice in command mode. 6. RUNNING ENTIRE NOTEBOOKS 1. To run the entire notebook, go to the "Cell" menu and choose "Run All." 2. Alternatively, you can run cells selectively by clicking on them and executing individually. 7. VISUALIZING OUTPUT 1. Jupyter Notebook displays output such as printed values, plots, and other results directly below the corresponding code cell. 8. SAVING AND SHARING 1. To save your notebook, click the floppy disk icon or go to "File" > "Save and Checkpoint." 2. You can share your notebook by exporting it as a file (e.g., PDF or HTML) or by sharing the notebook file itself. 4.3 SHORTCUTS KEYS IN JUPYTER NOTEBOOK Command Mode (Press Esc to enter) SHORTCUTS DESCRIPTION `Enter` Enter edit mode (for editing a cell's content). `Shift + Enter` Run the current cell and move to the next one. `Ctrl + Enter` Run the current cell and stay on the same cell. `Alt + Enter` Run the current cell and insert a new cell below. `Up Arrow` Select the cell above the current cell. `Down Arrow` Select the cell below the current cell. Command Mode Shortcut Keys 4.3 SHORTCUTS KEYS IN JUPYTER NOTEBOOK Edit Mode (Press Enter to enter) SHORTCUTS DESCRIPTION `Tab` Indent or complete code (auto-completion). `Shift + Tab` Display function/method signatures and documentation. `Ctrl + ]` Indent selected lines or the current line. `Ctrl + [` Remove indent selected lines or the current line. `Ctrl + /` Comment/uncomment selected lines or the current line. `Ctrl + Shift + -` Split the current cell at the cursor. `Ctrl + Shift + -` Merge the cell above with the current cell. `Ctrl + A` Select all code in the current cell. `Ctrl + Z` Undo changes in the current cell. Edit Mode Shortcut Keys 4.3 SHORTCUTS KEYS IN JUPYTER NOTEBOOK SHORTCUTS DESCRIPTION `Shift + Tab` Display tooltip with documentation for the current object. `Ctrl + Space` Trigger code completion. `Esc + F` Find and replace within the notebook. `Ctrl + Shift + Open the command palette (useful for searching and P` executing commands). `Esc + O` Toggle cell output. Other Useful Shortcuts SUMMARY Thank you.

Use Quizgecko on...
Browser
Browser