Skip to main contentSkip to solution

import matplotlib.pyplot as plt

In the above statement 'plt' is ________

Solution

✅ Correct Option: 1

The keyword as in an import statement gives the imported module a shorter name. Here plt is an alias for the module matplotlib.pyplot, so you can write plt.plot() instead of matplotlib.pyplot.plot().


Option 4: plt.plot() and plt.show() are functions, but plt itself stands for the whole module, not a function.

Options 2 and 3: plt is not a class or an interface, because it is just another name for a module.

The alias name is only a convention. plt is the standard choice for matplotlib.pyplot, just as np is for NumPy and pd is for pandas.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question