Unit 7 - Module 2 - Python Functions, Modules and Libraries Flashcards

1
Q

What is a section of code that can be reused in a program?

A

Function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are functions that exist within Python and can be called directly?

A

Built-in functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are functions that programmers design for their specific needs?

A

User-defined functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What keyword is placed before a function name to define a function?

A

def

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an object that is included in a function definition for use in that function?

A

Parameter (Python)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When range(3,7) is writin, what numbers will it display?

A

3,4,5, and 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the data brought into a function when it is called?

A

Argument (Python)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

“bmoreno”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Python statement that executes inside a function and sends information back to the function call?

A

Return Statement

def remaining_login_attempts(maximum_attempts, total_attempts):

return maximum_attempts - total_attempts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is used to return information from a function?

A

return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an object that is included in a function definition for use in that function?

A

Parameter

def remaining_login_attempts(maximum_attempts, total_attempts):

print(maximum_attempts - total_attempts)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What do you call data tha tis bropught into a function when it is called?

A

Argument

remaining_login_attempts in the following example, the integers 3 and 2 are considered arguments:

remaining_login_attempts(3, 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a variable that is available through the entire program?

A

Global Variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a variable assigned within a function?

A

Local Variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Out function outputs a specified object to the screen?

A

print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What function returns the largest numeric input passed into it?

A

max()

17
Q

What function sorts the components of a list?

A

sorted()

18
Q

What is a collection of modules that provide code users can access in their programs?

A

Library

19
Q

What is a Python file that contains additional function, variables, classes, and any kind of runnable code?

A

Module

20
Q

What is an extensive colection of usabke Python code that often comes packaged with Python?

A

Python Standard Library

21
Q

What is a resource that provides stylistic guidelines for programmers working in Python?

A

PEP 8 Style guide

22
Q

What’s a note programmers make about the intentions behind their code

A

Comment

23
Q

What do you call the space added at the beginning of a line of code?

A

Indentation

24
Q
A