Outline for March 7, 2012

  1. Example from last lecture
    1. Unordered list, go all the way to the end [search-1c.py]
    2. Ordered list, stop when word is excluded [search-2c.py]
  2. True and False
    1. Really, 0 an 1
    2. In tests: non-zero or non-empty is True, zero or empty is False
  3. while, else, break, return
    1. else is associated with if or try ... except, never while (if condition in while is false, the loop is not traversed, and control passes to the next statement)
    2. return must be within a function (not a while loop, unless that is in a function)
    3. break immediately exits the containing loop
  4. Characters and numbers
    1. How characters are represented on the computer
    2. chr(n), ord(ch)
    3. Example: encryption [caesarenc.py], [caesardec.py]

A PDF version is available here.
ECS 10, Basic Concepts of Computing
Winter Quarter 2012