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

# Logical Operations

### Create some simulated variables

`x = 6`

`y = 9`

`z = 12`

### x or y

`x or y`

```
6
```

### x and y

`x and y`

```
9
```

### not x

`not x`

```
False
```

### x is equal to y

`x == y`

```
False
```

### x is not equal to y

`x != y`

```
True
```

### One is less than two

`1 < 2`

```
True
```

### Two is less than or equal to four

`2 <= 4`

```
True
```

### Three is equal to five

`3 == 5`

```
False
```

### Three is not equal to four

`3 != 4`

```
True
```

### x is less than y which is less than z

`x < y < z`

```
True
```

### x is less than y and y is less than z

`x < y and y < z`

```
True
```

#### Find an error or bug?

Everything on this site is available on GitHub. Head to and submit a suggested change. You can also message me directly on Twitter.