Comments are used to understand the code later or to leave messages in the code.

There are two types of comments:

  1. Single-line comment

  2. Multi-line comment

file: 11_comments.py

# single-line comment
 
# This is also a multi-line comment style using multiple #
 
"""
This is a multi-line string
often used as a multi-line comment
"""

Note

Python officially supports single-line comments using #.
Multi-line comments are usually written using multiple # or triple quotes (""" """).

<< Python Keywords | Python Style Guide >>