# Running and Quitting

## Overview

Teaching: 15 min
Exercises: 0 min
Questions
• How can I run Python programs?

Objectives
• Launch the Jupyter Notebook, create new notebooks, and exit the Notebook.

• Create Markdown cells in a notebook.

• Create and run Python cells in a notebook.

## Python programs are plain text files.

• They have the .py extension to let everyone (including the operating system) know it is a Python program.
• This is convention, not a requirement.
• It’s common to write them using a text editor but we are going to use the Jupyter Notebook.
• The bit of extra setup is well worth it because the Notebook provides code completion and other helpful features.
• Notebook files have the extension .ipynb to distinguish them from plain-text Python programs.
• Can export as “pure Python” to run from the command line.

## Use the Jupyter Notebook for editing and running Python.

• The Anaconda package manager is an automated way to install the Jupyter notebook.
• It also installs all the extra libraries it needs to run.
• Once you have installed Python and the Jupyter Notebook requirements, open a shell and type:

## Solution

The notebook shows the equation as it would be rendered from latex equation syntax. The dollar sign, \$, is used to tell markdown that the text in between is a latex equation. If you’re not familiar with latex, underscore, _, is used for subscripts and circumflex, ^, is used for superscripts. A pair of curly braces, { and }, is used to group text together so that the statement i=1 becomes the the subscript and N becomes the superscript. Similarly, -i is in curly braces to make the whole statement the superscript for 2. \sum and \approx are latex commands for “sum over” and “approximate” symbols.

## Key Points

• Python programs are plain text files.

• Use the Jupyter Notebook for editing and running Python.

• The Notebook has Command and Edit modes.

• Use the keyboard and mouse to select and edit cells.

• The Notebook will turn Markdown into pretty-printed documentation.

• Markdown does most of what HTML does.