Python Comments



Comments are used to make the program more readable

Creating a comment

We can create a comment using "#" in python

For example: 

#This is a Comment

print("Welcome to SelfLearn")


These comments are ignored by the compiler and will not interpret.

When it comes to Multi-line comment, Python doesn't support any specific multiline comments but however, you can use the """triple quotes""" , as these strings are not assigned to any variable python interpreter will read the code and ignore the sentence inside the quotes as they haven't assigned to any specific variable.


Here is an example for that:

#This is a Comment

print("Welcome to SelfLearn")


""" Python doesn't
have any specific
syntax for
Multiline comments. but you can use this"""

print("Programming in python")


Post a Comment

0 Comments