The logic combinations you learned from the last exercise are called "boolean" logic expressions. Boolean logic is used everywhere in programming. They are essential fundamental parts of computation and knowing them very well is akin to knowing your scales in music.
In this exercise you will be taking the logic exercises you memorized and start trying them out in python. Take each of these logic problems, and write out what you think the answer will be. In each case it will be either True or False. Once you have the answers written down, you will start python in your terminal and type them in to confirm your answers.
I will also give you a trick to help you figure out the more complicated ones toward the end.
Whenever you see these boolean logic statements, you can solve them easily by this simple process:
I will demonstrate with a variation on #20:
3 != 4 and not ("testing" != "test" or "Python" == "Python")
Here's me going through each of the steps and showing you the translation until I've boiled it down to a single result:
With that we're done and know the result is False.
Warning
The more complicated ones may seem very hard at first. You should be able to give a good first stab at solving them, but do not get discouraged. I'm just getting you primed for more of these "logic gymnastics" so that later cool stuff is much easier. Just stick with it, and keep track of what you get wrong, but do not worry that it's not getting in your head quite yet. It'll come.
After you have tried to guess at these, this is what your session with python might look like:
$ python
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> True and True
True
>>> 1 == 1 and 2 == 2
True