1
1
Aaron Stevens
23 March 2009
CS101 Lecture 23: The Function of Functions
2
Overview/Questions Whats the point? Writing functions Calling - - PDF document
CS101 Lecture 23: The Function of Functions Aaron Stevens 23 March 2009 1 Overview/Questions Whats the point? Writing functions Calling functions Formal parameters Actual parameters Scope rules and name spaces
1
2
3
4
5
6
7
8
9
10
11
A function definition has the form:
def function(<formal-parameter-list>): <statement> <statement>
A function call has the form:
function(<actual-parameter-list>)
At run time, the actual parameters (passed by the caller) are (shallow) copied into the formal parameter list. Thus, the function can use the variables declared in its formal parameter list.
12
13
14
15
Available online at: http://openbookproject.net//thinkCSpy/