In general, Comments are used in a programming language to describe the program or to hide the some part of code from the interpreter.
Comments in Python can be used to explain any program code. It can also be used to hide the code as well.
Comment is not a part of the program, but it enhances the interactivity of the program and makes the program readable.
Python supports two types of comments:
In case user wants to specify a single line comment, then comment must start with ‘#’
# This is single line comment
# This is single line comment.
print("Hello Python")
Hello Python
Multi lined comment can be given inside triple quotes.The must start at begining of the line.
''' This
Is
Multiline comment'''
'''This
is
Multi line comment'''
print("Hello Python")
Hello Python
# This example demonstrates usage of Comments
''' print() used to
print/display
text on screen '''
print("Welcome to Python")
#Assign value to variables
a=20
b=30
#print sum of two numbers
print("Sum is")
print(a+b)
Welcome to Python
Sum is
50