Writing Comments in Python


  • How to write comments in Python?
  • How to write single line comments in Python?
  • How to write multiple line comments in Python?
  • What are the types of comments in Python?


In Python there are two (2) types of Comments in Python:

  • Single Line Comments
  • Multiple Line of Comments

Comments are statements which are not readable to an interpreter and will not be executed. Basically, comments are used to specify details such as why we have written the block of code, etc.

Single Line Comments are defined using hash sign (#) whereas multiple line comments are defined using three times double quote for opening and closing as mentioned below.



[sourcecode language=”python”]
# This is Single Line Comment.


print ("Now I understand comments in python.")

Please refer above code to write comments in Python.


Steps to Run the above code:

  • Navigate to the folder/directory where you have saved your python code or file.
  • Here I have considered that python file is saved on “c:\>” and the File name is “Comments.py
  • Just type the following command now to execute the Python program: c:\> python Comments.py


Download code:

  • Navigate to GitHub repository and download the code from here: Comments.py


We conduct Python Training and Workshop for Corporates and College Students, if interested, please write to us on kloudsancyber@gmail.com


Aatul Palandurkar
Life Coach, International Trainer, and Author