Question 10
Back to Exercise
Which statement about docstrings is correct?
- A Any comment that starts with ##
- B A comment that Python removes before compiling
- C A string that must be passed to print()
- D A string literal that is the first statement of a module, function or class; it is stored in __doc__ Correct
Correct Answer: Option D
Docstrings are real string objects kept at run time – help() and IDEs read them from __doc__. Comments, in contrast, are discarded.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!