How can you embed a docstring within a Python function?

  • By adding a leading hyphen
  • By enclosing in {} braces
  • By prefixing with '#'
  • By using triple quotes
In Python, docstrings are embedded within functions using triple quotes (''' or """). They provide documentation and can be accessed using .__doc__.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *