Python Comment

notes for humans that make code easier to read and maintain

Apr 09, 2026

Python Comments

Comments are descriptions that help programmers better understand the intent and functionality of the program. It is completely ignored by the Python interpreter. In Python, we use the hash symbol # to write a single-line comment.

Example:

# printing a string
print ('Hello world')

Output:

Hello world

Here, the comment is # printing a string. This line is ignored by the Python interpreter. Everything that comes after # is ignored. Multi-Line Comments in Python can use # at the beginning of each line of comment on multiple lines.

Example:

# Using multiple
# It is a multiline comment
print ('Hello world')

Output:

Hello world

Here, each line is treated as a single comment and all of them are ignored. In a similar way, we can use multiline strings (triple quotes) to write multiline comments as shown below. The quotation character can either be ' or ".

Example:

''' I am a
multiline comment!'''
 
print("Hello World")

Output:

Hello World