Functions Flashcards
Function
Named series of statements
Can be built-in or created by programmer
Can be used in an assignment statement
Function Definition
Consists of def keyword, function’s name, and block of statements
Block
Series of indented statements following the function definition
Return
Returns execution to the next statement after the call
Function only return one item (which could be be a tuple or list)
Parameter
Input to a function that influence’s its behavior
Cannot be an expression
Argument
Value passed to a parameter
Hierarchical Function Call
Function argument provided by user input
aka Nested Function Call
Polymorphism
A function can perform the same action on different data types
Inherent part of Python language
Dynamic Typing
Interpreter determines type of objects as program executes
Static Typing
Requires programmer to define the type of every variable
Function Stubs
Function definitions without statements
Used in incremental programming
Pass
Keyword that acts as placeholder for a required statement in a function stub
Local Variables
Variables that are only visible inside the scope of a function
Global Variable
Variables defined outside of a function
Can also be accessed within functions
Global Statement
Modifies the value of a global variable from within a function