Python: Comments

It’s always a good practice to add comments to your code, it describes the functionality of the code. It’s also useful for making small notes like To Do’s so that you can refer back to it later.

In Python there are two ways of using comments in your code.

For single line comments you use the # and follow by a comment:

# This is a single line comment

For multiple line or block comments you use the triple double quotes:

"""
this is a multi-line comment
line 1
line 2
"""

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

what is 8 + 4?