Python TutorialLesson 6Free preview
Python Comments
This lesson is part of Python · All levels
Summary
Comment is a note that is not executed by an interpreter and is useful for explaining the content of the code. In Python, one-line comments are written with the # sign, while a string docstring triple quote can be used as a function or module documentation. Proper commenting makes code easier for teams to understand without changing program behavior.
Key points
- The # sign starts with a one-line comment that the interpreter passes.
- Multi-line comments can be written with a three-quotation mark.
- Docstrings are often used to document functions or modules.
- The comment explains why a code was written, not the repetition of the code itself.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.