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()