Here are some exercises for you to try on your own. Solutions are available at http://pragprog.com/titles/gwpy3/practical-programming.
What value does each expression produce? Verify your answers by typing the expressions into Python.
- True and not False
- True and not false (Notice the capitalization.)
- True or True and False
- not True or not False
- True and not 0
- 52 < 52.3
- 1 + 52 < 52.3
- 4 != 4.0
Variables x and y refer to Boolean values.
- Write an expression that produces True iff both variables are True.
- Write an expression that produces True iff x is False.
- Write an expression that produces True iff at least one of the variables is True.
Variables full and empty refer to Boolean values. Write an expression that produces ...