python

Add comments in python

In this post, we are going to describe how to add one and multiple line comments in Python.

#Write comment text here
print("Hello World 1!")

print("Hello World 2!") #OR like this

"""
This is a multiline comment
You can add as much lines as you want
"""
print("Hello World 3!")
Output
Hello World 1!
Hello World 2!
Hello World 3!

There are two ways to add comments in python. Either you can add '#' before any string or sentence or you can use """ comment text """ string literals. Python code will ignore the text written between them.

Was this helpful?