Flashcards
Functions
Cards in this deck (18)
- 1FunctionA named sequence of statements that performs some useful operation. Functions may or may not take arguments and may or may not produce a result.
- 2Function DefinitionA statement that creates a new function, specifying its name, parameters and the statements it executes.
- 3Function ObjectA value created by a Function Definition. The name of the function is a variable that refers to a function object.
- 4Function HeaderThe first line of a function definition
- 5Function BodyThe sequence of statements inside a function definition.
- 6ParameterA name used inside a function to refer to the value passed as an argument.
- 7Function CallA statement that executes a function, having function name with argument list.
- 8ArgumentA value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.
- 9Local VariableA variable defined inside the function. A local variable can only be used inside its function. Scope of variable is inside function only.
- 10Global VariableA Variable defined outside the function. A global variable can be used throughout the program. Scope of variable is in the whole program.
- 11Return ValueIt is the result of a function. If a function call is used as an expression, the return value is the value of the expression.
- 12ModuleA file that contains a collection of related functions & other definitions.
- 13Import statementA statement that reads a module file & creates a module object.
- 14Dot notationThe syntax for calling a function in another module by specifying the module name followed by a dot (Period) & the function name.
- 15Flow of executionThe order in which statements are executed during a program run.
- 16Default ParameterA default value is a value that is predecided and assigned
to the parameter when the function call does not have
its corresponding argument. - 17Good Programming PracticeOnly using
the required function(s)
rather than importing a
module saves memory. - 18"""Docstrings"""It is also called Python
documentation strings.
It is a multiline comment
that is added to describe
the modules, functions,
etc. They are typically
added as the first line,
using 3 double quotes.