How to Create a Single Line Comment in Python


In this example, we will learn how to create a single line comment starting with a # in Python.

Source Code

# This is a comment
print('I love Python!')

print('I love Python!')    # This is a comment

Output:

I love Python!
I love Python!
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement