Python Chapter 3 Flashcards
Define a function call
A function call is a statement that executes a function. It consists of the function name followed by an argument list.
Define function
A named sequence of statements that performs some useful operation. Functions may or may not take argument and mayor may not produce a result
What is function definition
A statement that creates a new function, specifying its name, and the statement it executes
What is a function object
A value created by a function definition. The name of the function is a variable that refers to a function object
Define header
The first line of a function definition
Define body
The sequence of statements inside a function definition
Define parameter
A name used inside a function to refer to the value passed as an argument
True or false: the left side of an assignment statement has to be a variable name
True
What are the rules for naming a function or a variable?
The first character cannot be a number
You cannot use a keyword is the name of the function
You should avoid having a variable and a function with the same name
Describe the syntax for defining a function (the header)
Def print_lyrics():
Def - defines the function
Print_lyrics is the function name
() empty parenthesis mean the function takes no arguments
The header must end with :
Describe the syntax of the body of function definition
It must be indented with four spaces
It can contain any number of statements
And the function you have to enter an empty line (not for script)
Define argument
A value provided to a function when the function is called. This value is assigned to be corresponding parameter in the function
Define local variable
A variable inside the function. A local variable can only be used inside its function
Define return value
The results of a function. If a function called it is used as an expression, the return value is the value of the expression.
Define fruitful function
A function that returns a value