- Comments in Python are notes in your code that are not executed.
- They help explain what the code is doing or provide additional context.
Why use comments?
Clarify Code: They make it easier to understand what the code does.
Document Changes: They help keep track of changes and reasons for modifications.
Help Others: They make it easier for others to understand your code.
In Python, there are two types of comments:
Single-Line Comment: Starts with # and is used for short notes.
Example:
Example:
# This is a single-line comment.
Multi-Line Comment: Uses triple quotes (""" or ''') to cover multiple lines.
Example:
""" This is a multi-line comment. It extends across several lines. """
0 Comments