4: Functions Flashcards
Argument
A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.
Algorithm
A general process for solving a category of problems
Body
The sequence of statements inside a function definition.
Composition
Using an expression as part of a larger expression, or a statement as part of a larger statement.
Deterministic
Pertaining to a program that does the same thing each time it runs, given the same inputs.
Dot notation
The syntax for calling a function in a mother module by specifying the module name followed by a dot (period) and the function name.
Example:
> > > import random
random.random (1,5)
4
Flow of execution
The order in which statements are executed during a program run.
Fruitful function
A function that returns a value.
Function
A named sequence of statements that performs some useful operation. Functions may or may not take arguments and may or may not produce a result.
Function definition
A statement that creates a new function, specifying its name, parameters, and the statement it executes.
Function object
A value created by a function definition. The name of the function is a variable that refers to a function object.
Header
The first line of a function definition
Import statement
A statement that reads a module file and creates a module object.
Module object
A value created by an import statement that provides access to the data and code defined in a module.
Parameter
A name used inside a function to refer to the value passed as an argument.