What are Python comments and docstrings?

Python basics · Freshers

Model answer

A comment starts with # and is ignored by Python. A docstring is a string as the first statement in a module, function or class, in triple quotes, that documents it. Tools and help() read docstrings, so write them for public functions.

Learn this topic

What Is Python? Install It and Write Your First Program in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions