AND/OR operators


The introductory explanation states that boolean operators AND and OR “return” TRUE in respective conditions. Where exactly is True or False returned? Nothing appears in the console when I hit Run.


You will have to print the result for it to appear in the console.


so I type “print” what?


Post a link to the exercise so we can see what is expected.

Thank you


There is no instruction to print your results. Evaluate the expression (with pencil and paper, or in your head) and write in your expected result. If you get it wrong then study the expression some more to see why you got it wrong.

These questions (there are a number of exercises like this) are the perfect opportunity to sharpen your thinking skills and be able to evaluate on sight, without the aid of the computer, logical expressions when you encounter them. Without this skill, you will not be able to write your own logic since you won’t be able to think it through.


Thank you for your detailed reply, but I am afraid I did not understand what exactly I need to do (I am an absolute beginner).


To make myself more clear, I have no problem with the expressions. I understand which one should return true and which one evaluates to False. My problem is that nothing returns.


Nothing should return. The lesson checker is looking to see if you wrote in the correct boolean.

2 ** 3 == 108 % 100 or ‘Cleese’ == ‘King Arthur’

Break this down into the two operands…

2 ** 3 == 108 % 100

'Cleese' == 'King Arthur'

Now work on the first comparison

2 ** 3     =>  8
108 % 100  =>  8

So True for that operand. Since this is an OR expression, we only need one true operand so can ignore the second one (which is False, anyway).

bool_one = True

is what your first entry should look like. Follow through with the others using this same process so your brain starts to look for signals in the expression.

OR  =>  short-circuits on True

AND =>  short-circuits on False


Thank you very much.


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