Wednesday, November 27, 2019

Comments in Python

Comments

Comments are the statements which we don't want to be read by the compiler or the interpreter of any language.

Location
There are two types of Comments in most of the language.

1. Single Line
2. Multi Line

Single Line comments in Python begins with symbol #
Example: 

print ("I am before the comments")
#this lne is ignored by the complier
print ("I am after single line comment")

Output:

I am before the comments

I am after single line comment

Multi Line comments begins and ends with ''' three single quote symbol
print ("I am before the comments")
#this lne is ignored by the complier
print ("I am after single line comment")
''' these lines
will be
ignored by the
complier'''
print("I am after multiline comments")

Output: 

I am before the comments
I am after single line comment
I am after multiline comments

No comments:

Post a Comment