2) b. Boolean Examples




Tobe Notobe does not like chitter-chatter. But he likes games. For that, he says to his friends: “my name is always true but my surname not!”. Define two variables in Python, named after our hero’s name and surname that are Boolean True and Boolean False.




Testius Checkinson wants to find out what the new variables’ values are. But instead of directly typing Tobe he does Tobe or Notobe. The result is True. What are the possible values for the variables Tobe and Notobe?

1
2
3
Output:
True
False




One more test from our diligent scientist Testius Checkinson:
>>> Tobe and not Notobe
True
What are now the values of the variables Tobe and Notobe?

1
2
3
4
5
6
Output:
True
True
True
Hence Tobe = True
And Notobe = False




What would Testius obtain had he typed
>>> Tobe and 1 and True




Are these two expressions identical? Why?
>>> not Tobe == Notobe
>>> Tobe == not Notobe

1
2
3
Output:
True
True