Python Comment and Statement With Examples

So, in this tutorial we are going to learn about Python Comment and Statement. Previously we learned about Keywords and Identifiers in Python.

Python Comment are statements that are not part of your program. For this reason, comment statements are skipped while executing your program. Usually we use comments for making brief notes about a chunk of code. Also comments are important so that other can understand easily while reading your program. On the other hand, comments are also useful for the programmer himself. One can understand a program done a long time a ago simply from the comments of the program.

Here’s an example of comment-

If you run this, then you will see output will be like this below picture-

So you can see the lines starting with # are not executed. Those are the comments.


In Python there are two types of comments- Single line comments and Multiple lines comments. Single line commenting is commonly used for a brief and quick comment (or to debug a program, we will see it later). On the other hand we use the Multiple lines comments to note down something much more in details or to block out an entire chunk of code.

In Python for single line comments use # sign to comment out everything following it on that line.

Multiple lines comments are slightly different. Simply use 3 single quotes before and after the part you want to be commented.

Python Statement

Statements are logical lines we write in our code. Statements can be like below.

  1. Assignment Statement:
  2. Addition Statement:
  3. Subtraction Statement:
  4. Multiplication Statement:
  5. Division Statement:

And many more. These are only some examples.

Alright, we are done with Python comment and statement. Try to run every piece of code snippet given here in your own machine. As there’s an old saying – “if you want to learn how to swim, then jump into the water”.
#happy_coding 🙂

By admin

Leave a Reply

%d bloggers like this: