Python Comments

  • Comments is  used to explain Python code.

  • Comments is used to make the code more readable.

  • Comments is used to prevent execution when testing code.

Python Support two types of comments:

  • Single line comments

  • Multiline comments

 

Single-Line Comments

 

In python Single Line Comments can be done using the hash (#) symbol at the beginning of the line.

Like –

>>>a = 5  # this is my comment

#print("Hello, Codersarts")
print("Hello, Codersarts!")

Multi-Line Comments

Multiline comments are done using delimiter (“””) at the start and end of lines.

Like that –

#This is a multi line  comment

#written in
#more than just one line
print("Hello, World!")

OR

"""

This is a multi line  comment

written in
more than just one line

"""

print("Hello, World!")

Thanks for reading this, if you have any doubt please do the comments so we can make changes if anything’s is missing.

In the next tutorial, we will learn about “python variables

Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram