# Outline for January 25

Due: Homework 2, due on February 1 at 11:55pm

1. Conditions
1. Resolves to boolean value
2. Literal booleans: True (1), False (0)
3. Relational operators
1. Use two arithmetic expressions connected with relational operators to create a boolean
2. Relational operators: >, >=, <, <=, ==, !=
3. Precedence: resolved after arithmetic operators
4. Connectives: and, or, not
5. 6 > 2 + 3; "UCD" == "Sac State"
2. Indefinite loops: execute until a general condition is false (while)
1. while [while.py]
2. Contrast with for
3. break causes program to fall out of loop (works with for too) [loop1.py]
4. continue causes program to start loop over immediately (works with for too) [loop1.py]
3. Definite loops: execute a specific (definite) number of times (for)
1. General form: for i in iterator
2. Iterator is either list or something that generates a list
3. Very common form: for i in range(1, 10)
4. range() in detail [for.py]
1. range(10) gives 0 1 2 3 4 5 6 7 8 9
2. range(3, 10) gives 3 4 5 6 7 8 9
3. range(2, 10, 3) gives 2 5 8
4. range(10, 2, -3) gives 10 7 4
5. Handling exceptions
1. except [except0.py]
2. except error [except1.py]
3. else [except2.py]
4. except error as msgvar [except3.py]
5. finally [except4.py]
6. Exceptions in a function: who handles them? [except5.py, except6.py]

 Matt Bishop Office: 2209 Watershed Science Phone: +1 (530) 752-8060 Email: mabishop@ucdavis.edu