# Evaluating boolean operators

#1

Hi all! I am currently stuck on the following exercise:

https://www.codecademy.com/courses/python-beginner-BxUFN/2/5?curriculum_id=4f89dab3d788890003000096#

I can't seem to understand exactly how to simplify not/and/or statements. The hint on the exercise states the following:

1. `True or not False and False`. `not` gets evaluated first, so we have `True or True and False`.

2. `and` goes next, so we get `True or False`.

3. As we've seen, `True or False` is `True`, so the value finally returned is `True`!

How does `True or True and False` come out to `True or False`? And why would `True or False` come out to `True`? I can't seem to recall learning this, despite it stating so.

Thanks!

#2

As they have stated, `not` gets evaluated first and you understand that.
Next, `True or True and False` becomes `True or False` because `and` gets evaluated first (like order of operations). And `True and False` is `False`.
Basically doing `True or (True and False)` -> `True or False`.

`and` produces `True` ONLY IF the booleans are ALL `True` such as `True and True`.
`or` produces `True` IF AT LEAST ONE of the booleans are `True` such as `True or False`.

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.