You are currently viewing How to Create Multiline Comment in Python

How to Create Multiline Comment in Python

Python supports a single line and multi-line comments. Based on different situations both commenting types can be used.

For single-line commenting, # is used to comment the line in python. Where ever is found Python will treat rest of the line as a comment.

Example:

print ('hello world')

# print('Demo')

Multiline Comments

A multiline comment is very useful in a Programming language when we want to comment on a complete block or write multiple lines about a function or feature. Python provides the facilities of multiline commenting.

To comment on multiple lines or a complete block ”’ is used.

Example 1: 
'''
Comment your code

'''

Example 2: 

for i in rage(1,10)

'''print("hello")

   print("world") 

'''

print(“My name is Demo”)

That’s it Folks on this topic. Let us know your comments on this article in the comment box below. Kindly like our Facebook page, follows us on Twitter and subscribe to our YouTube channel for latest updates.

 

Leave a Reply