Jupyter

We will be using jupyter notebooks exclusively in this class, so it will be worthwhile to get to know some shortcuts & overall functionality.

Two types of cells

Each little block of text or code is called a "cell." There are two types: either code, or text. If you are writing text, it is being processed by default as markdown. Markdown is a simple & common markup language. If you have tried to write your own webpage or used Github, you've probably used Markdown.

Markdown

For the purposes of this class, writing "markdown" will basically just involve writing simple text. However, here are a few useful text styles:

Italics: wrap the text to italicize with asterisks, like *this* (this)

Bold: wrap the text to bold with double asterisks, like **this** (this)

Hyperlinks: [text to display](https://mywebsitehere.com)

Headings: place hashtags in front of text. The fewer the number of hashtags, the larger the font. E.g.,

# Big title

Big title

## subtitle

Subtitle

### sub-subtitle

sub-subtitle

Bullet lists: place single asterisk before each item:

* item1

* item2

* item3

Math

Math in markdown looks similar to math in LaTeX. Dollar signs around math code will display math:

$$ \int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15} $$

Here is a handy "cheat sheet" for how to write math in a Jupyter notebook.

Navigating cells

Pressing esc will switch into "command mode." From here, you can skip the mouse and use simple keyboard shortcuts to do everything. For example:

For more tips and tricks, you can bookmark this page

Code

To run your code, hit Shift + enter.

by prepending a library, method or variable with ?, you can access the Docstring for quick reference.

Avoid long strings of commented text inside a code cell. If you find yourself doing this a lot, break the cell and write in markdown.

Most Common Libraries

We will be relying primarily on a handful of python libraries for this class. I encourage you to look up the documentation for each of them and see what they are for and what their strengths are.

Catch-up, prep, and refreshers

If you are relatively new to coding, you will need to familiarize yourself with a few basics, as this is not an intro to python class. However, it is a learning objective for this class that you gain familiarity with coding in python.

Please familiarize yourself (or review) the following:

You are not expected to know anything "off the bat," however, it will be your responsibility to fill in any gaps of knowledge so that we can move forward at an appropropriate pace. Quiz material will occasionally have coding questions typically about some kind of function or operation emphasized in the week's lectures.

A bit of command line

Here are a few handy tricks and tips for working at the command line if this is new to you. My goal is to convert at least one student to working at the command line!

Basic commands

The syntax for command line commands is: $ command -options input. Many commands (like functions you will build yourselves) have default *arguments* meaning that you don't have to specify any options or any input for the command to do something.

For instance,

$ ls is short for the word "list" and is a command that will print out all non-hidden files in the current directory. So the default option is "none" and the default input is the current directory. If you type at the command line:

$ ls -a adds the "all" option which will show all files including hidden ones (which will start with a ".")

Here are some of the most useful commands you may want to know about files, paths, and directory manipulations: