In Python, comments are short summaries that are added to the code to make it more readable. They are used by programmers to record their thought processes when producing code. It explains why a certain line of code was written in the first place.
There are two ways to annotate your code in Python. The first is to provide comments that explain or indicate what a particular section of code (or snippet) accomplishes. The second approach employs multi-line comments or paragraphs as documentation for others reading your code.
In Python, a comment begins with the hash character # and continues until the end of the physical line. However, a hash character within a string value is not considered a comment. A remark can be written in three different ways: on its own line, next to a line of code, or as a multi-line comment block.
Block comments, inline comments, and documentation strings are the three types of comments available in Python.
A line of text in a Python programme that is not executed by the interpreter is known as a remark. During debugging, comments are used to detect problems and explain code. The hash symbol (#) is used to begin comments.