Chapter 11 Flashcards

1
Q

base case

A

A branch of the conditional statement in a recursive function that does not result in a recursive call.

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

data structure

A

An organization of data for the purpose of making it easier to use.

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

exception

A

An error that occurs at runtime.

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

handle an exception

A

To prevent an exception from terminating a program using the try and except statements.

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

immutable data type

A

A data type which cannot be modified. Assignments to elements or slices of immutable types cause a runtime error.

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

infinite recursion

A

A function that calls itself recursively without ever reaching the base case. Eventually, an infinite recursion causes a runtime error.

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

list comprehension

A

A syntactic construct which enables lists to be generated from other lists using a syntax analogous to the mathematical set-builder notation.

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

mutable data type

A

A data type which can be modified. All mutable types are compound types. Lists and dictionaries (see next chapter) are mutable data types; strings and tuples are not.

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

raise

A

To signal an exception using the raise statement.

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

recursion

A

The process of calling the function that is currently executing.

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

recursive call

A

The statement in a recursive function with is a call to itself.

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

recursive definition

A

A definition which defines something in terms of itself. To be useful it must include base cases which are not recursive. In this way it differs from a circular definition. Recursive definitions often provide an elegant way to express complex data structures.

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

tail recursion

A

A recursive call that occurs as the last statement (at the tail) of a function definition. Tail recursion is considered bad practice in Python programs since a logically equivalent function can be written using iteration which is more efficient

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

tuple

A

A data type that contains a sequence of elements of any type, like a list, but is immutable. Tuples can be used wherever an immutable type is required, such as a key in a dictionary

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

tuple assignment

A

An assignment to all of the elements in a tuple using a single assignment statement. Tuple assignment occurs in parallel rather than in sequence, making it useful for swapping values.

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