Computer Science
Assertion. The documentation for a Python module should be written in triple-quoted strings.
Reason. The docstrings are triple-quoted strings in Python that are displayed as documentation when help <module> command is issued.
Python Libraries
1 Like
Answer
(a)
Both Assertion and Reason are true and Reason is the correct explanation of Assertion.
Explanation
Docstrings are typically written within triple-quoted strings (i.e., using """ or '''), which allows for multiline strings. When the help<module>
command is issued in Python, it retrieves and displays the documentation string (docstring) associated with the specified modules, classes, functions, methods.
Answered By
1 Like
Related Questions
A folder having .py files along with a special file i.e, __init__.py in it is an importable Python package.
The statement from <module> import <objects> is used to import a module in full.
Assertion. After importing a module through import statement, all its function definitions, variables, constants etc. are made available in the program.
Reason. Imported module's definitions do not become part of the program's namespace if imported through an import <module> statement.
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.