Chapter 5 Flashcards
Function
A group of statements withing a program that perform as specific task.
What is a nickname for a function?
Divide and conquer
Modularized Program
A program wherein each task within the program is in its own function.
What are the benefits of using a function?
Simpler code, code reuse, better testing and debugging, faster development, easier facilitation of teamwork.
Void Function
Simply executes the statements it contains and then terminates.
Value-returning Function
Executes the statements it contains, and then it returns a value back to the statements that called it.
How are functions named?
They have the same rules as variables.
Function Definition
Specifies what the function does.
Function Header
First line of function
Block
Set of statements that belong together as a group.
Main Function
A function that is called when the program starts. (Has all the other functions/code in it)
Top-Down Design
Technique for breaking algorithm into functions.
Hierarchy Chart
Depicts relationship between functions.
Local Variable
Variable that is assigned a value inside a function.
Scope
The part of a program in which a variable may be accessed.
Argument
Is any piece of data that is sent into a function.
Parameter Variable
Variable that is assigned the value of an argument when the function is called.
Scope of Parameter
The function in which the parameter is used.
Global Variable
Created by assignment statements written outside all of the functions.
Global Constant
Global name that references a value that cannot be changed.
Void Function
Group of statements within a program for performing a specific task.
Value-returning Function
Group of statements within a program for performing a certain task that returns a value.
Boolean Function
Returns wither True or False.
Standard Library
Library of pre-written functions that comes with Python.
Modules
Files that store functions of the standard library.
random Module
Includes library functions for working with random numbers.
Dot Notation
Notation for calling a function belonging to a module.
randint Function
Generates a random number in the range provided by the arguments.
randrange Function
Similar to range function, but returns randomly selected integer from the resulting sequence.
random Function
Returns a random float in the range 0.0 and 1.0.
Uniform Function
Returns a random float but allows user to specify range.
Seed Value
Initializes the formula that generates random numbers.
math Module
Part of a standard library that contain functions that are useful for performing mathematical calculations.
Modularization
Grouping related functions in modules.