Chapter 4 - Creating Functions Flashcards
Keyword
Name given to words that have special meanings
Generally, these words cannot be used as variable or function names
def
Defining a function in Python
Parameters
Variables that get their value from the arguments within a function call
How function refers to inputs
return
Keyword ‘return’ followed by an expression that returns the value for the function
One way of getting data out of a function
Scope
Variables defined within a function only exist in said function
Function Input
Arguments of a function call assigned to function parameters
Function “takes” an input
Function Output
Returned from data created within a function
Function “returns” data
Docstrings
Describing what a function does, what each parameter is for, the expected data type and what the function returns
Generalization of Functions
Modifying a function that solves a specific problem, so that it can solve a wide array of problems
Cohesion
Functions that perform one well-defined task