Python Multiline Comment Tutorial with Examples – POFTUT

Python Multiline Comment Tutorial with Examples

Comments are used to put some text into the Python code. This text can be used to explain something about the application or some method data etc. Python provides two types of comments named Single Line and Multi-Line.

Single Line Comment

# is used to create a single-line comment. We will put # to the start of the line and the whole line will be interpreted as a comment and there will be no command execution.

Multiline Comment

Python also provides the multiline string which is triple quotes in our code. We will put triple quotes in order to start the multiline comment and put triple quotes to end the multiline string.

We can also use strings in multiline comments start and end lines by providing comments.

Multiple Single Line Comment

There is also an alternative way to create multiline comments in Python. We can use multiple single-line comments.

LEARN MORE  SQL Comments Tutorial with Example

Commenting Code

We can also comment on valid code. This will make the code just comment and the code line will not be executed. In this example, we will comment the print("Hello") line and there will be no output.

echo '

Leave a Reply

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