{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The elements of a Jupyter Notebook" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "remove-input" ] }, "outputs": [], "source": [ "# Run this cell to view a YouTube video related to this topic\n", "from IPython.display import YouTubeVideo\n", "YouTubeVideo('cthzk6B80ds', height=350, width=600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Jupyter Notebooks are made up of cells, which contain either content or code. \n", "\n", "Content cells are written in Markdown, which is a markup language for formatting content.\n", "\n", "Code cells, in turn, contain code, which in our case is written in Python 3." ] }, { "cell_type": "markdown", "metadata": { "tags": [ "remove-cell" ] }, "source": [ "To see the difference between Markdown and code cells in Jupyter Notebook, run the cells below.\n", "\n", "To run a cell, press the _Run_ button in the toolbar on top of the Jupyter Notebook or press the Shift and Enter keys on your keyboard at the same time." ] }, { "cell_type": "raw", "metadata": {}, "source": [ "This is a markdown cell." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"This is a code cell.\")" ] }, { "cell_type": "markdown", "metadata": { "tags": [ "remove-cell" ] }, "source": [ "As you can see, running the cell moves the *cursor* (indicated by the coloured bounding box around the cell) to the next cell." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The code cells, such as the one above, are typically run one by one, while documenting and describing the process using the content cells. \n", "\n", "You can also run all cells in a notebook by choosing _Run All_ in the _Cell_ menu on top of the Jupyter Notebook. Press H on your keyboard for a list of shortcuts for various commands.\n", "\n", "The number in brackets on the left-hand side of a cell indicates the order in which cells have been executed.\n", "\n", "In most cases, cells must be run in a sequential order for the program to work." ] } ], "metadata": { "celltoolbar": "Edit Metadata", "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 2 }