Python, numpy, matplotlib Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

At the top of the matplotlib hierarchy is the _____ which is provided by the _____ module. At this level, functions are used to add lines, images, text, etc. to the current axes in the current figure.

A

state-machine environment; matplotlib.pyplot

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

Pyplot’s state-machine environment provides an environment that closely emulates which commercial software package?

A

MATLAB

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

Matplotlib is the whole package; ____ is a module in matplotlib; and ____ is a “convenience module” that gets installed alongside matplotlib designed to mimic the MATLAB environment (but is no longer recommended).

A

matplotlib.pyplot; pylab

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

____ is a convenience module that bulk-imports matplotlib.pyplot and numpy into a single namespace. Although many examples use ____, it is no longer recommended.

A

pylab

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

You can turn a Python list comprehension into a generator expression simply by replacing ____ with ____.

A

…by replacing square brackets, [ ], with parentheses, ().

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

You can think of a Python list comprehension as a ____ wrapped in a list constructor.

A

generator expression

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

The performance improvement from the use of generators is the result of _____, which translates to lower memory usage.

A

lazy (on demand) generation of values

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

How do you (and the Python interpreter) recognize that a function definition is actually a generator?

A

Both functions and generators use the “def” keyword. But functions “return” values, whereas generators “yield” values.

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

Generator functions create _____.

A

generator iterators, AKA generators

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

In Python, ______ create generator iterators, usually called just “generators.”

A

Generator functions (i.e., a def that uses “yield” instead of “return”)

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