Add Logic (Exercise)
In this exercise, we’re adding some logic. So you should figure out what the result will be, either
False, when evaluating the following expressions. So first, again, think about it and then type them into the interactive window to check your answers. And you’ve got four expressions here. First one is
(1 <= 1) and (1 != 1).
And you want to know what this complete expression evaluates to, so is it going to be
False in the end if all of these parts of it are evaluated. And then we have another one that is
not (1 != 2).
And another one that reads
("good" != "bad") and this expression is in parentheses, and then
or False. And finally, we have one that is, again, in parentheses,
("good" != "Good") and then it continues with
and not, and again, in parentheses, we have
(1 == 1).
This is going to require a little bit more thinking, and just go piece by piece, see what it evaluates to, is it
False, and then move on to the next part, and then you will come to a final conclusion.
Become a Member to join the conversation.