Comments are notes in your code meant for humans to read. Python ignores comments when executing code. They help explain what the code does and make programs easier to understand and maintain.
#.""" or '''.Use the hash symbol # for single-line comments.
Use triple quotes """ or ''' for multi-line comments that can span multiple lines.
# This is a comment
print("Hello, Python!") # This prints a message
"""
This is a multi-line comment
It can span multiple lines
"""
print("Python ignores this comment")
In both examples, Python completely ignores the commented lines.
Hello, Python!Python ignores this commentComments are there only for humans. They help you remember why you wrote the code in a certain way and help others understand your logic.