How to write a comment in Python

Use a hash character # at the beginning of the text to write a comment in Python. Hash works with a single line, use # on the next line to comment again.

Code:

# I am just a comment
# Begin with # to write a comment
# It is so easy to write a comment in Python

 

Output:



Python Code Editor Online - Click to Expand