How are docstring different from comments?
Answer:
Docstrings |
Comments |
They are used to describe functions and classes and show what parameters they accept and what they return. |
They are used to explain the working of a code and sometimes to exclude a bit of code without removing it. |
The docstring of a certain method or class can be viewed using the help( ) function. |
Not visible while executing the code. |