Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to install Matplotlib using pip.
Matplotlib
pip [1] matplotlib Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pip update matplotlib' instead of 'install'.
Typing 'pip remove matplotlib' which deletes the package.
✗ Incorrect
Use pip install matplotlib to install the Matplotlib library.
2fill in blank
mediumComplete the code to import Matplotlib's pyplot module.
Matplotlib
import matplotlib.[1] as plt
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'import matplotlib.plot as plt' which is incorrect.
Trying to import 'pylab' which is different.
✗ Incorrect
Matplotlib's plotting functions are in the pyplot module, imported as plt.
3fill in blank
hardFix the error in the code to display a simple plot.
Matplotlib
plt.plot([1, 2, 3], [4, 5, 6]) plt.[1]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plt.display()' which does not exist.
Forgetting to call any function to show the plot.
✗ Incorrect
Use plt.show() to display the plot window.
4fill in blank
hardFill both blanks to create a virtual environment and activate it.
Matplotlib
python -m [1] env source env/[2]/activate
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'python -m env env' which is incorrect.
Trying to activate with 'source env/activate' missing the 'bin' folder.
✗ Incorrect
Create a virtual environment with python -m venv env and activate it with source env/bin/activate.
5fill in blank
hardFill all three blanks to install Matplotlib inside a virtual environment and verify the version.
Matplotlib
source env/bin/activate pip [1] matplotlib import matplotlib print(matplotlib.[2]) print(matplotlib.__[3]__)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to print 'matplotlib.version' instead of 'matplotlib.__version__'.
Using 'pip update' instead of 'install'.
✗ Incorrect
Activate the environment, install Matplotlib with pip install matplotlib, then check the version with matplotlib.__version__.