Python Fundamentals

How To Comment Python Code?

Comments are very important in computer programming . It describes what's going on inside a program so that a person looking at the source code does not have a hard time figuring it out. Comments in Python start with the hash character # and extend to the end of the physical line. Since comments are to clarify source code and are not interpreted by Python , they may be omitted when typing in examples.
#My first comment in Python
The above line is not executed in Python .

Another example:

# Adding 2 numbers x = 10 # first variable y = 20 # second variable c = x + y # find the sum of variables print(c)

output is 30

Python Multiline comments

If we have comments that extend multiple lines, one way of doing it is to use hash (#) in the beginning of each line.
# This is # Multiple line # Comments example
A common way to use comments for multiple lines is to use the triple-quoted strings(''') symbol.
''' This is multiple line comment '''
Note: Python does not support multiline comments like C/C++ or .Net . However there is nothing to stop you to use multi-line docstrings as multiline comments . This is also mentioned by Guido van Rossum, the creator of Python.