Python Tutorial – Comments


Python Comments ✈️

1. Single line comments.
2. Multi line comments.

Single Line Comment #

Syntax

# This is a comment... (The content after # will be ignored)

Example

#print("Hello World")
print("Hello SaludPCB") #print("Hello 123")

Result

Hello SaludPCB

Multi Line Comments “”” … “”” & ”’ … ”’

Syntax

"""
This is a comment... (will be ignored by python)
This is a comment... (will be ignored by python)
This is a comment... (will be ignored by python)
"""

'''
This is a comment... (will be ignored by python)
This is a comment... (will be ignored by python)
This is a comment... (will be ignored by python)
'''

Example

"""
This is a comment...
This is a comment...
print("Hello World")
"""
print("Hello SaludPCB")
'''
print("Hello World 1")
print("Hello World 2")
print("Hello World 3")
'''

Result

Hello SaludPCB