Python Comments

Comments are essential for any programming language. It provides the readability to our program, and the Python interpreter ignores the commented code.

There are two ways to apply comment in the Python code. It is very good to practice to use comments in the code to make code more understandable. Without using comments, code can be confusing. If we want to highlight any statement of code without executing it, then comment that statement. 

A comment is not a part of the code, but it makes code more readable.

Single-line Comment

The single-line comment is created by using # (hash) character at the beginning of the line. It is automatically terminated at the end of the line. For example:



Multiline Comment

Multiline comment can be created inside the triple quotes. For Example:


Pin It on Pinterest

Share This