Learning machine learning? Try my machine learning flashcards or Machine Learning with Python Cookbook.

# Arithmetic Basics

## Create some simulated variables

```
x = 6
y = 9
```

## x plus y

`x + y`

```
15
```

## x minus y

`x - y`

```
-3
```

## x times y

`x * y`

```
54
```

## the remainder of x divided by y

`x % y`

```
6
```

## x divided by y

`x / y`

```
0.6666666666666666
```

## x divided by y (floor) (i.e. the quotient)

`x // y`

```
0
```

## x raised to the y power

`x ** y`

```
10077696
```

## x plus y, then divide by x

`(x + y) / x`

```
2.5
```

## Classics vs. floor division. This varies between 2.x and 3.x.

### Classic divison of 3 by 5

`3 / 5`

```
0.6
```

### Floor divison of 3 by 5. This means it truncates any remainder down the its “floor”

`3 // 5`

```
0
```

#### Find an error or bug?

Everything on this site is available on GitHub. Head to and submit a suggested change. Include the tutorial's URL in the issue.