Python CH6
______ lets you think about the big picture without worrying about the details.
Abstraction
______ are essentially variable names inside the parentheses of a declared function header.
Parameters
______ represent different areas of your program that are separate from each other.
Scopes
By reusing code and other elements that already exist, companies can gain productivity and get their projects done with less effort.
True
Changing a mutable parameter directly inside of a function is considered creating a side effect.
True
Every declared function has its own scope.
True
Functions in Python can also receive and return values.
True
Not having variables to receive all of the values returned from a function will generate an error.
True
Python allow the programmer to specify default parameter values for functions.
True
Software reuse provide for consistency across software products.
True
The first line of a function declaration ends with a colon.
True
Unless you re writing a short, simple program, it s usually a good idea to encapsulate even the main part of it.
True
The ask_number() function in the tic-tac-toe program will
ask for any number in a range and return that number.
Given a declared function header as food(item, qty, price), what is value of item when called as food("burger", 1, 1.19)?
burger
To declare a function, precede the function name with the keyword _____.
def
Functions have a special mechanism that allows you to document them with what s called a ______.
docstring
The main() function must always return an int value.
false
To gain complete access to a global variable named student_data use
global student_data # in the function where you want access
______ are variables available only within the body of a declared function.
Locals
Given a declared function header as food(item, qty, price), what is value of qty when called as food(1.19, "slice of pizza", 1)?
"slice of pizza"
______ are values, variables or expressions inside the parentheses of a function call.
Arguments
________ helps keep independent code truly separate by hiding the implementation details from other programs.
Encapsulation
IBM's chess playing Deep Blue can map out all possible chess moves.
False
If a company already has not tested piece of code, then it can be assumed that the code is bug-free.
False
Python can only return one value from a function.
False
The return type of a function in Python must always be a string.
False
You cannot create your own modules and import your functions into a new program, you can only import standard Python modules.
False
______ are variable visible within the entire program.
Globals
Which of the following is not an example of a function available in Python?
In
Python allows ______ parameter assignments.
named and positional