Python Chapter 3 Flashcards

0
Q

Define a function call

A

A function call is a statement that executes a function. It consists of the function name followed by an argument list.

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

Define function

A

A named sequence of statements that performs some useful operation. Functions may or may not take argument and mayor may not produce a result

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

What is function definition

A

A statement that creates a new function, specifying its name, and the statement it executes

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

What is a function object

A

A value created by a function definition. The name of the function is a variable that refers to a function object

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

Define header

A

The first line of a function definition

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

Define body

A

The sequence of statements inside a function definition

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

Define parameter

A

A name used inside a function to refer to the value passed as an argument

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

True or false: the left side of an assignment statement has to be a variable name

A

True

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

What are the rules for naming a function or a variable?

A

The first character cannot be a number
You cannot use a keyword is the name of the function
You should avoid having a variable and a function with the same name

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

Describe the syntax for defining a function (the header)

A

Def print_lyrics():

Def - defines the function
Print_lyrics is the function name
() empty parenthesis mean the function takes no arguments
The header must end with :

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

Describe the syntax of the body of function definition

A

It must be indented with four spaces
It can contain any number of statements
And the function you have to enter an empty line (not for script)

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

Define argument

A

A value provided to a function when the function is called. This value is assigned to be corresponding parameter in the function

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

Define local variable

A

A variable inside the function. A local variable can only be used inside its function

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

Define return value

A

The results of a function. If a function called it is used as an expression, the return value is the value of the expression.

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

Define fruitful function

A

A function that returns a value

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

Define void function

A

A function that does not return a value

16
Q

Define module

A

A value created by import statement that provides access to the values defined in a module

17
Q

Define dot notation

A

Syntax for calling a function in another module by specifying the module meeting followed by a dot (period) And the function name

18
Q

Define composition

A

Using an expression as part of a larger expression, or statement as part of a larger statement

19
Q

Define flow of execution

A

The order in which statements are executed during a program run

20
Q

Define stack diagram

A

A graphical representation of a stack of functions, there are variables, and the values they refer to

21
Q

Define frame

A

A box in a stack diagram that represents a function call. It contains the local variables and parameters of the function

22
Q

Define traceback

A

A list of the functions that are executing, printed when an exception occurs