Outline for April 15, 2014

Reading: text, §4
Due: April 17, 2014
  1. Quick look at using functions [quad.py]
    1. Passing values to functions
    2. Returning values from functions
  2. In more detail: passing values to functions [args.py]
    1. Formal parameters in subject definition
    2. Actual parameters (arguments)
    3. Matching arguments to formal parameters
    4. Local variables
  3. In more detail: how Python does function calls [quad.py]
    1. Caller suspends execution at point of call, remembers where it left off
    2. Formal parameters assigned values from actual parameters
    3. Execute function body
    4. Return control to where caller left off
  4. Refactoring code
    1. Compute the perimeter of a triangle [peri0.py]
    2. Collapse similar statements: make the distance between 2 points a function [peri1.py]
    3. Collapse similar statements: make the prompts a function [peri2.py]
    4. Refactor for clarity only: make the perimeter computation a function [peri3.py]
    5. Now add error checking [peri-c.py]
  5. Add error checking: “quad.py” done right [quad-c.py]

You can also obtain a PDF version of this. Version of April 12, 2014 at 9:33PM