# Outline for May 6, 2009

1. Booleans
1. Values are True, False
2. Values considered False: None, False, 0 of any type, empty string, empty list, empty sequence; all others True
3. Variable assignment
4. Short-circuit evaluation
2. Operators and truth tables
1. and, or, not
2. A and B, A or B, not A
3. Basic rules of Boolean algebra
1. A and true == A, A and false == false
2. A or true == true, A or false == A
3. not (not A) == A
4. Distributive laws
1. A or (B and C) == (A or B) and (A or C)
2. A and (B or C) == (A and B) or (A and C)
5. De Morgan’s Laws
1. not (A or B) == (not A) and (not B)
2. not (A and B) == (not A) or (not B)
3. Combining operations
1. Precedence: who “binds” more tightly
2. Here, “not” highest precedence; then “and”; then “or”
1. a or not b and c is (a or ((not b) and c))
3. c. Relational operators have higher precedence
1. a == b and c == d is ((a == b) and (c == d))
4. Danger: response == "Y" or "y" doesn’t do what you think
4. Other types of loops
1. break, continue (see loop1.py)
2. Post-test (repeat ... until); put test at bottom
3. Loop and a half (see loop2.py)
4. Example (see sent2.py)