Python Comments

  • Non-executing statements in python programming.
  • Comments are used to make code more readable to the user.
  • It is also used for future reference of code.

Single line Comment:

We use the hash(#) symbol to start writing a comment.

Example

#This is a comment
print("Hello, World!")

Output

Hello, World!

Multiple line Comment:

Use triple single(“””Comment”””)/double(”’ comment”’) quotes.

Example

"""
This is 
a multiple
line
Comment
"""
print("Hello, World!")

Output

Hello, World!

Multiple line Using Hash(#):

Example

#This is
#multiple
#line
#comment
print("Hello, World!")

Output

Hello, World!

Leave a comment