Comments

Comments are used to provide explanatory notes or documentation within the code. They are ignored by the Python interpreter and do not affect the execution of the program.

Comments help explain the purpose and functionality of code. They provide additional information for other programmers (and yourself) to understand what the code does, how it works, and why certain decisions were made during its implementation. Well-placed comments can significantly enhance the clarity and readability of code.

You can add single line comments using hash #

# This is a single-line comment

Or you can add multi line comments. To do this enclose your comments in triple quotes “““

”””

This is a multi-line comment.

It can span across multiple lines

and ...

Get Python Made Easy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.