ENGINEER 1D04 Final: chapter 6 (2)
scarletotter976 and 37168 others unlocked
4
ENGINEER 1D04 Full Course Notes
Verified Note
4 documents
Document Summary
Functions can be used to reduce code duplication and to make programs more understandable and easier to maintain. Formal parameter: a parameter appears in the function definitions. Actual parameter: the expression that appears in a function call. The part of the program that creates a function is called a function definition. When is subsequently used in a program, we say that the definition is called or invoked. Scope: refers to the places in a program where a given variable may be referenced. The only way for a function to see a variable from another function is for the that variable to be passed as a parameter. A general form of a function definition def(): A function is called using its name followed by a list of actual parameters or arguments. All functions in python return a value, regardless of whether or not the function actually contains a return statement.