Computer Science
Assertion. Python offers two statements to import items into the current program : import and from <module> import, which work identically.
Reason. Both import and from <module> import bring the imported items into the current program.
Python Libraries
4 Likes
Answer
(e)
Both Assertion and Reason are false or not fully true.
Explanation
The import <module>
statement imports the entire module into the new namespace setup with same name as that of module, while the from <module> import <item>
statement imports specific items from the module into the current namespace. Hence, they both are different statements.
Answered By
1 Like
Related Questions
Assertion. If an item is imported through from <module> import <item> statement then you do not use the module name along with the imported item.
Reason. The from <module> import command modifies the namespace of the program and adds the imported item to it.
Assertion. Python's built-in functions, which are part of the standard Python library, can directly be used without specifying their module name.
Reason. Python's standard library's built-in functions are made available by default in the namespace of a program.
What is the significance of Modules ?
What are docstrings ? What is their significance ? Give example to support your answer.