In [1]:

```
7 + 2
```

Out[1]:

9

In [2]:

```
7 - 2
```

Out[2]:

5

In [3]:

```
7 * 2
```

Out[3]:

14

In [4]:

```
7 ** 2
```

Out[4]:

49

`7 ** 2`

is $ 7 ^ 2 $

In [5]:

```
7 / 2
```

Out[5]:

3.5

In [6]:

```
7 // 2
```

Out[6]:

3

In [11]:

```
7 % 2
```

Out[11]:

1

$\frac{7}{2} = 3r1$

`7 // 2`

gives us the $3$

`7 % 2`

gives us the $1$ (the *remainder*)

In [12]:

```
2 > 1
```

Out[12]:

True

In [13]:

```
2 > 2
```

Out[13]:

False

In [16]:

```
2 >= 2
```

Out[16]:

True

In [17]:

```
4 == 4
```

Out[17]:

True

In [18]:

```
4 != 6
```

Out[18]:

True

This demonstrates the *mapping pattern*.

*Map* is a mathematical term that means going from one value to a corresponding value.

This is also referred to as the *transform pattern*.

In [ ]:

```
%%file for_class/transform_a_list.py
def make_bigger(numbers):
bigger_numbers = []
for number in numbers:
bigger = number * 2
bigger_numbers.append(bigger)
return bigger_numbers
if __name__ == '__main__':
a_few_ints = [1, 2, 3, 4, 5, 6, 7, 8]
bigger = make_bigger(a_few_ints)
print(a_few_ints)
print(bigger)
```

`smaller_numbers.py`

¶Write a function that creates a new list where each item has been divided by 2.

You can pass lists to functions and return lists from functions.

This demonstrates the *filter pattern*.

A new collection is created with certain items filtered out.

This demonstrates the *selection pattern*.

A single item is selected from a collection.

This demonstrates the *accumulator pattern*.

`total`

accumulates the values in the collection.

- Arithmetic operators
*mapping pattern**filter pattern**selection pattern**accumulator pattern*