Course Content

# Data Types in Python

1. Getting Familiar With Numbers in Python

4. Bring All the Topics Together

Data Types in Python

## And, Or, Not Operators

In real life, almost everyone expresses their thoughts using phrases like **"Yes or No"**, **"Definitely Not"**, **"Yes, yes and yes!"**. Python language permits you to do almost the same, but it uses more formal phrases based on the statements `and`

, `or`

, and `not`

.

`X`

and `Y`

can be any logical statement (`True`

or `False`

):

Statement | Syntax | Purpose |

`and` | `X and Y` | Returns `True` only if `X` and `Y` are both `True` |

`or` | `X or Y` | Returns `True` in all cases, except if `X` and `Y` are both `False` |

`not` | `not X` | If `X` is `True` , it changes it to `False` , and vice versa |

Let's look at the table below to understand the logic of each operator:

X | Y | X or Y | X and Y | not X |

`True` | `True` | `True` | `True` | `False` |

`True` | `False` | `True` | `False` | `False` |

`False` | `True` | `True` | `False` | `True` |

`False` | `False` | `False` | `False` | `True` |

# Task

It's time for some tricky tasks!

Here, you should replace`___`

with a `True`

or `False`

statement to make:

- The
`statement1`

variable equal to`True`

. - The
`statement2`

variable equal to`False`

.

Everything was clear?

Course Content

# Data Types in Python

1. Getting Familiar With Numbers in Python

4. Bring All the Topics Together

Data Types in Python

## And, Or, Not Operators

In real life, almost everyone expresses their thoughts using phrases like **"Yes or No"**, **"Definitely Not"**, **"Yes, yes and yes!"**. Python language permits you to do almost the same, but it uses more formal phrases based on the statements `and`

, `or`

, and `not`

.

`X`

and `Y`

can be any logical statement (`True`

or `False`

):

Statement | Syntax | Purpose |

`and` | `X and Y` | Returns `True` only if `X` and `Y` are both `True` |

`or` | `X or Y` | Returns `True` in all cases, except if `X` and `Y` are both `False` |

`not` | `not X` | If `X` is `True` , it changes it to `False` , and vice versa |

Let's look at the table below to understand the logic of each operator:

X | Y | X or Y | X and Y | not X |

`True` | `True` | `True` | `True` | `False` |

`True` | `False` | `True` | `False` | `False` |

`False` | `True` | `True` | `False` | `True` |

`False` | `False` | `False` | `False` | `True` |

# Task

It's time for some tricky tasks!

Here, you should replace`___`

with a `True`

or `False`

statement to make:

- The
`statement1`

variable equal to`True`

. - The
`statement2`

variable equal to`False`

.

Everything was clear?