Outline for October 5, 2012
Reading
: § 3
Assignment Due
: October 12, 2012 at 5:00PM
Functions [
hello.py
]
What functions are
Defining them
Using them
Quick look at using them [
quad.py
]
Passing values to functions
Returning values from functions
In more detail: passing values to functions [
args.py
]
Formal parameters in subject definition
Actual parameters (arguments)
Matching arguments to formal parameters
Local variables
In more detail: how Python does function calls [
quad.py
]
Caller suspends execution at point of call, remembers where it left off
Formal parameters assigned values from actual parameters
Execute function body
Return control to where caller left off
The
right
way to do quad.py [
quad-c.py
]
A PDF version is available here.
ECS 10, Basic Concepts of Computing
Fall Quarter 2012