Chapter 4 - Creating Functions Flashcards

1
Q

What are the parameters of a function?

A

The variables that the function uses to refer to the arguments it is given in a call to that function.

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

What are the differences between arguments and parameters?

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

What does the return statement do?

A

As soon as its executed, not matter where it is in the function, execution of the function immediately ceases, the value of the accompanying expression is returned, and execution continues from the line immediately after the call that invoked the function.

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

What is a docstring?

A

documents what inputs and outputs are.

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

What information should a docstring contain?

A

What the function does, what each parameter is for, the expected data type of the argument to that parameter, and what the function returns (if anything).

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

What is generalization?

A

The process of modifying a function/algorithm that solves a specific problem so that it can solve a wider range of problems, or a larger number of instances of the same problem.

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