1/26
Looks like no tags are added yet.
What are modules in Python?
Modules are collections of Python code that someone else wrote, often stored in a single file.
What is a package in Python?
A package is a collection of related modules.
How do you import a whole module in Python?
Use the command: import
What is the syntax to call a function from an imported module?
How can you import individual functions from a module?
Use the command: from
What happens when you import all functions from a module using *?
You bring in all functions, but it can cause conflicts with existing functions.
What is the command to import all functions from a module?
from
What is an example of importing a specific function from a module?
from math import sqrt.
What is the purpose of the math module in Python?
It provides functions for mathematical operations, such as sin and sqrt.
How do you rename a function when importing it?
Use the syntax: from
What is the command to display available functions in a module?
Use: import
How can you access documentation for a function in a module?
Use: help(
What is pip used for?
Pip is a routine for installing Python packages.
What command do you use to install a package with pip?
pip install
What is the Python Package Index?
A repository of registered packages/modules available for Python.
What is the difference between a module and a library?
A module is a single file of code, while a library is a collection of modules.
What is the recommended way to import the numpy and matplotlib packages?
import numpy as np; import matplotlib.pyplot as plt.
What is the purpose of the numpy package?
It is used for performing vector and matrix operations.
What is the purpose of the matplotlib package?
It is used for creating data plots.
What should you do before installing a new module?
Read the documentation to understand how it works.
What is an example of a built-in module in Python?
math, cmath, or random.
What is the command to create a linear space in numpy?
np.linspace(start, stop, num).
How do you plot data using matplotlib?
Use plt.plot(x, y) followed by plt.show().
What is a common issue when importing all functions from a module?
You may unintentionally overwrite existing functions.
What is the significance of the init.py file in a package?
It indicates that the directory should be treated as a package.
What is a submodule?
A module that is part of a package, accessed using
What does the command 'import math' do?
It imports the entire math module, making its functions available.