Outline for April 1, 2009

Reading: §1.6–1.9 Guest Lecturer: Justin Cummins

  1. Administration
    1. Show python website and textbook on Google Book Search
    2. Mention HW1 has been released
    3. Demonstrate Smartsite submission
    4. Separate HW1 submission into separate files
  2. IDLE
    1. What is it and what to use it for
    2. How to start/open a new window
    3. Explain shell and “>>>” marks
  3. First program: Hello, World
    1. Explain printing
    2. Demonstrate program in shell and as source code file
  4. Second program: print “2 + 2 =”, 2 + 2
    1. Quotes denote text rather than numbers (values)
    2. Comma automatically adds a space and stays on the same line
  5. Other print statements
    1. Dividing by 0
  6. Chaos program, line by line (se chaos.py)
    1. Comments
    2. Function definition
    3. Tab indenting to denote being part of function definition
    4. Function input() gets values from user
    5. Assignment to variable; evaluate right hand side first
    6. For loop in detail
      1. Built-in range() function
      2. Index variable i initialized to 0
      3. Loops
      4. Expression using multiplication, subtraction, and variables
    7. Behavior with initial values of 0.25 and 0.26
  7. Chaotic phenomena
    1. Unpredictability: no simple formula for 1000th value; it must be computed
    2. Sensitivity to initial parameters
    3. Dependent on k-value (here, initially 3.9)