Let’s see the different ways there are to put comments in Python. We have three ways to handle comments in Python.
The first will be to have a line with the comment. To do this, what we do is put the pound symbol before the beginning of the line.
# This is a one-line Python comment
The second way will be to put it after a sentence. In this case we use the hash again, although in this case, behind the sentence.
print "Examples of Comments" # After a sentence
The third way will be if we want to put a comment on multiple lines. To do this we must have a line with three quotes (single or double), then the comments lines and at the end another line with three quotes.
'''
Comments
multi-line
'''
In this case it is a bit contradictory since Python does not consider it as a comment, the comments would only be the hash marks, but rather it is a multi-line text string that is not assigned to a variable.
These are the three ways we can include comments in Python.