CBSE Class 12 Computer Science
Question 48 of 62
Using Python Libraries — Question 1
Back to all questionsIf we invoke the tempConversion module with two different types of import statements (import tempConversion and from tempConversion import *), the way we call the module's functions will be affected as follows:
1. import tempConversion — This imports the entire module in a new namespace setup with the same name as that of the module tempConversion. To call the module's functions, we need to use the dot notation tempConversion.<function_name>.
For example:
import tempConversion
tempConversion.to_centigrade(32)
tempConversion.to_fahrenheit(0) 2. from tempConversion import * — This imports all objects (functions, variables, etc.) from the module into the current namespace. This approach imports all objects directly into the current namespace, so we can call the module's functions without using the module name.
For example:
from tempConversion import *
to_centigrade(32)
to_fahrenheit(0) 