# Issue with OR exercise in Conditions & Control Flow

#1

In line 5 of the code, dealing with bool_three. 100^0.5 (100 ** 0.5 in code) equals 10. This is neither greater than or equal to 50 making this would make this side of the logical operator False to my understanding. On the other side of the OR is False, which would make this side also False. Based on the operations of this logic operator, wouldn’t the answer be False instead of True?

The error message I get is for line 5 being incorrect, I have posted the code as it is when I get the error. Am I missing something or doing a calculation wrong?

``````bool_one = 2 ** 3 == 108 % 100 or 'Cleese' == 'King Arthur'

bool_two = True or False == True

bool_three = 100 ** 0.5 >= 50 or False == False

bool_four = True or True == True

bool_five = 1 ** 100 == 100 ** 1 or 3 * 2 * 1 != 3 + 2 + 1 == True`````````

#2

Well, let’s take a look:

• `100 ** 0.5 >= 50` is `False`

so,

`False or False` is `False`, that’s correct, but now we have our comparison operator `==` which checks if something is `True`. So `False == False` is `True` because `False` is equal to `False`.

Why is the lesson not letting you pass, well, look at the 3rd instruction in the lesson. You added `== False` which the lesson didn’t want.

#3

Ah, I gotcha. Thanks for your help. I thought there was something I was missing.

#4

I had another question, this one on the This and That (or This, But Not That!) Section. Specifically bool_five

``````False or not (True and True)
False or not True
False or False
False  ==  False

``````

It says set the value equal to the result, which I have done for the others. But I may be running into the previous issue.

#5

Hi @funkyzebra,
Our assignment to each variable given (e.g `bool_one`) should be either `True` or `False`.
Does that make sense?

(Check out the hint in the instructions, it’s pretty helpful.)

#6

Yep, got it now. Thank you!

#7

Aside

When visually evaluating logical expressions, look over the entire expression before starting from left to right or according to precedence. The thng to watch for is, short-circuiting.

``````T or F  => short-circuits on True,
``````

The next operand is not even evaluated. So when looking at a complex expression where two operands are separated by OR, look for the expression that is True and forget the rest.

``````False == False  =>  True
``````

is all we need to evaluate. Forget the math in the first operand since it has no bearing on the outcome.

Similarily, with AND, there is also short-circuiting, this time on False. So again, examine the expression in its entirety and look for the False operand. If none are found then the only outcome is True for the whole expression.

``````F and T  =>  short-circuits on False
``````

An added note, be sure to just enter the outcome as your response. Do not include the expression in your answers.

``````bool_three = False
``````

is what your answers should look like. Do not use the computer to evaluate the expressions. Do them on sight, in your head, keeping in mind the above tips.

#8

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