How to Write Comment in Python

Single line comment using the hash symbol (#):

# Greetings
# These lines will be ignored by Python
print("Welcome to CodeFindr")

Multiline comments using triple quotes ('''):

'''
Lines between the quotes are technically ignored by the interpreter and can act as comments.

'''

Triple quotes can be written twice each quote (""") as below:

"""
Lines between the quotes are technically ignored by the interpreter and can act as comments.

"""

Warning: If a triple-quoted string is placed immediately after a function, class, or module definition, it becomes a docstring (documentation string) and is stored as metadata. 

Leave a Comment

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

Scroll to Top