How to make Comments in Python 3?


In this article you will learn about the comments in python 3 and also you know about the different ways of making comments in python.

    purpose of different ways of making comment in python
    Comment in Python

    Let's start...

    If you are a programmer then you do code, when you do a lot of code in a same program then it is hard to find a piece of code which you need to edit or more. So, you have a technique which is comment, making comment before doing programs is easy to search special code block.

    Q. What is comments and when comments are needed to do in program or script?

    Comments are description of program or script. Which are not read by interpreter during compiling and run time. When we write any program or script then we want to give some description of code for understanding purpose and make it understandable to user who see the code or edit it for various reason.  

    In python, there are three way of making comment in python.


    1. Single line comment
    2. Multiple line comment


    Single line comment : It is used to indicate what a section of code does. 

    for example: if we solve any program and want to tell what does program perform then you can make a single line comment describing the work like it perform checking the number whether it is palindrome or not.

    In python, there is one way of making single line comment.

    ways of making single line comment in python
    Single Line Comment

    In above sample pic of program in python, there is a single line comment starting with a character ' # ' and that line is not read by interpreter. Now, it is clear how can you make single line comment in python.


    Multiple line comment : It is used to serve as documentation for others to make them clear to understand what does the script perform. It is used for more detailing of code or script as a documentation purpose only.

    for example: If you make a project with multiple line comment as a documentation to make it clear for you and your client and it is obvious that code or script is very lengthy. If ever you want to update the code then you can easily find and understand a piece of code what does it mean.

    In python, there are two way of making multiple line comment.

    First making three double quotes like this """   """.

    Second making three single quotes like this '''    ''''.

    different ways of making multiple line comment in python
    Multiple Line Comment

    In the above sample pic of program in python, there is a multiple line comment using two different ways of making it. First multiple line comment in above pic is using three double quotes and second multiple line comments using three single quotes. Now, it is clear how can you make multiple line comments in python.


    In this article, we have thoroughly read about comments in python 3 and its different way of making it. As you  have learn the types of making comment in python are of two types:-
    1. Single Line Comment 
    2. Multiple Line Comment
    If you are interested then also read:

    If you find this article helpful then please share!

    Tags: Comments in pythonTypes of comments in Python, Multiple line comment in python, Single line comment, Comments in python 3


    1. I would be so happy if you could provide a clear video explanation to each of steps to be taken. Thank you in advance for your time and consideration!

    2. Nice blog, I will keep visiting this blog very often. Vancouver SEO Agency

    3. Included indentation and object-oriented functional programming make it simple. Such advantages of Python makes it different from other languages and that's why Python is preferred for development in companies mostly. unindent does not match any outer indentation level

    4. The website designs that these companies provide are unique in their own way, each highlighting their skill and expertise in the website design field. Jake Hackett


    Powered by Blogger.