{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Operators\n", "\n", "Very generally, programming with Python - at its core - is a way to ask computer to store values and do things with them. We've now discussed variable definition and a number of the types of variables that exist in Python. But we haven't *really* started doing thins with them yet. Doing things with code requires carrying out **operations**. This is accomplished by using a number of types of **operators**. We'll introduce the different types of operators here and demonstrate how they're used when writing code." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "\n", "
=
for assignment.\n",
"+
, -
, *
, /
for 'sum', 'substract', 'multiply', and 'divide', repsectively.\n",
"**
for exponentiation,%
for floor division (or integer division), and %
for remainder (called modulus). These also return numbers.\n",
"and
, or
and not
for boolean logic. These operators return booleans.\n",
"==
, !=
, <
, >
, <=
, and >=
for value comparisons. These operators return booleans.\n",
"is
and is not
to compare identity. These operators return booleans.\n",
"in
and not in
to compare membership. These operators return booleans.\n",
"+
on strings does concatenation.\n",
"