Outline for November 16, 2012

Reading: § 14
Assignment Due: Wednesday, November 28, 2012 at 5:00 PM


  1. In list, or in a list in a list, etc. [isinlist.py]
  2. Objects, references, aliasing
    1. For strings, one copy: assume a = "banana"
      1. After b = a or b = a[:], then a is b is True
    2. For lists, multiple copies: assume A = [ 1, 2, 3 ]
      1. After B = A, then A is B is True
      2. After B = A[:], then A is B is False
  3. List methods
    1. Add elements to, remove elements: L.append(x), L.extend(ls), L.insert(i, x), L.pop(), L.remove(x)
    2. Element ordering: L.reverse(), L.sort()
    3. Other: L.count(x), L.index(x)
  4. Example use: linear search [linsearch.py]
  5. Example use: recursive linear search [rlinsearch.py]
  6. Example use: linear search using L.index(x) [linsearchix.py]
  7. Tuples
    1. Used to group data
    2. Like lists, but immutable


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