Comments in Python | Learn Python for free
What are comments in Python | Why are comments used in Python | What is the use of Comments in Python | Python tutorials For free | Multi-line Comments in Python
Comments in Python
What are Comments?
Comments are the
statements in a script that are ignored by the python interpreter and therefore,
have no effect on the actual output of the code.
Comments make the code
more readable and understandable for human beings.
Comments are not
necessary in a script , but these are highly recommended if the script is
too complex or if it is to be reviewed by multiple people over an interval of
time.
A comment in Python
starts with a hash symbol ( # ) anywhere in a line and extends till the end of
the line . The following code contains two single line comments:
# this is a line comment
x=10
y=x+100 # value of x+100 is assigned to variable y
print(y)
Multi-line comments -:
What are Multi line Comments?
Multi-line Comments are the comments which are written in multiple lines . they are written in two types, you can see them in the below image -:
0 Comments