If you have a function named fun inside a module named mod, how can you import it directly?
- from mod import fun
- fun(mod)
- import fun from mod
- include mod.fun
To import a specific function from a module, you use the syntax from mod import fun. This allows you to use fun directly in your code.
Loading...
Related Quiz
- When preprocessing data, the ____ class in Scikit-learn is used to encode categorical features as a one-hot numeric array.
- You are writing a Python script on a new system and realize it doesn't have the required module. Which command would you use to install this module?
- In Python, a ____ is a built-in data type used to store multiple items in a single variable.
- What is the primary difference between a class attribute and an instance attribute in Python?
- In Scikit-learn, the ____ method is used to calculate the accuracy of the model on the test data.