Unit 7 - Module 2 - Python Functions, Modules and Libraries Flashcards
What is a section of code that can be reused in a program?
Function
What are functions that exist within Python and can be called directly?
Built-in functions
What are functions that programmers design for their specific needs?
User-defined functions
What keyword is placed before a function name to define a function?
def
What is an object that is included in a function definition for use in that function?
Parameter (Python)
When range(3,7) is writin, what numbers will it display?
3,4,5, and 6
What is the data brought into a function when it is called?
Argument (Python)
The following block of code defines and calls a function. Which component of the code is an argument?
def display_username(username):
print("Username is", username)
display_username(“bmoreno”)
“bmoreno”
What is a Python statement that executes inside a function and sends information back to the function call?
Return Statement
def remaining_login_attempts(maximum_attempts, total_attempts):
return maximum_attempts - total_attempts
What is used to return information from a function?
return
What is an object that is included in a function definition for use in that function?
Parameter
def remaining_login_attempts(maximum_attempts, total_attempts):
print(maximum_attempts - total_attempts)
What do you call data tha tis bropught into a function when it is called?
Argument
remaining_login_attempts in the following example, the integers 3 and 2 are considered arguments:
remaining_login_attempts(3, 2)
What is a variable that is available through the entire program?
Global Variable
What is a variable assigned within a function?
Local Variable
Out function outputs a specified object to the screen?
print()
What function returns the largest numeric input passed into it?
max()
What function sorts the components of a list?
sorted()
What is a collection of modules that provide code users can access in their programs?
Library
What is a Python file that contains additional function, variables, classes, and any kind of runnable code?
Module
What is an extensive colection of usabke Python code that often comes packaged with Python?
Python Standard Library
What is a resource that provides stylistic guidelines for programmers working in Python?
PEP 8 Style guide
What’s a note programmers make about the intentions behind their code
Comment
What do you call the space added at the beginning of a line of code?
Indentation