Python supports two main types of comments: single-line comments and multi-line (or block) comments. Here’s how to write them:
Single-Line Comment
Start the line with a hash symbol #. Everything after # is ignored by Python.
# This is a single-line comment
x = 10 # This is an inline comment
Multi-Line (Block) Comment
There are two ways to write multi-line comments:
# This is a multi-line comment
# written using multiple hash symbols.
# Each line must start with #
Using triple quotes (''' or """)
'''
This is a multi-line comment
using triple single-quotes.
'''
"""
This is another multi-line comment
using triple double-quotes.
"""