Hello, boys, in this tutorial, we are going to learn about the comment in Python.
So what are the comments, comments in Python or in any programming language in general or just a text
in a program or get a text in a program that used to explain the code?
OK, and in computer programming in general, the comment is a reasonable explanation of a code.
And these comments make source code easier to understand for us.
And these comments are also ignored by interpreters or the compilers in programming languages and comments
in Python like it's obviously used to explain code and make our code more readable doors and other people
who are working on the project.
So let's see with some examples.
OK, now let's start with this.
Let's start one comment here.
So I started this has the Hassane, OK?
And let's put something here.
Let's something.
So now when we bring this program, we will get out here by an interpreter, ignore this comment, and
it will only give you the outlook of this program.
OK, so let's plan this and you can see the output and there is no comment in the in the output.
OK, so let's put another comment here, OK?
This is a greeting, and now, again, if I bring this again, we will just get the output, which is
this, and we will not get again.
The comments about this will be ignored by the Python interpreter.
And that is the whole point of this comment.
OK, the whole point of the comments in any language is to explain or make the code more readable.
OK, sometimes what happens when you work on the project, sometimes you need to remember the document,
what the board is for.
OK, sometimes you need to remember that this code is for that purpose.
OK, so we will get to understand what the code represents and that is the whole use of documents in
any language, in any programming languages and then also Python.
So start the comment with this hash sign and then to come in.
And also you can place the comments at the end of the call.
OK, so let's put another comment at the end of this program and we can see that we can use the comments
at the start of this program or the end of the program.
We can also use common sense to stop the execution of a.
OK, so let's see how.
So reveal the program, right?
OK, and then let's get out of this program and we will get out.
What do we want?
Don't want to execute this program.
You if you want to stop the execution of this program so you can use the comment, OK?
And now we've put in this.
It will be empty.
As you can see in the terminal.
It's empty.
OK, so you can stop the execution of the program using the comment in front of this prison.
And again, I've done this.
I only get to get this this output without you, without the comment, OK?
And we will not get this output which has come in.
OK.
Well, now let's talk about the multiline comments in Britain.
Britain does not help Syntex for multiline comments and the multiline comment you could insert or hassane
for each line like this, you could use the Hassane, each line like this or or we can use it another
way.
So we fibrin this not only to print the program like this and we will get the output comment and it
will be not printed.
Right.
So there is another way to read this comment.
Python interpreter ignored three literals.
Right.
String literals or quotes and that are not assigned to variable strings which are not assigned to the
variables are ignored by the Python interpreter.
So you can use the multiple string like a triple codes, like a tuple course like this to and placed
the documents inside this.
As you can see, this is a triple coated string, OK?
And it is not assigned to the variable and we can use this as a comment.
OK, so as long as this string is not assigned to the variable, the Python interpreter will read the
code and it will ignore it.
OK, again, you can see here in the terminal we only get the output which is printed.
So there is to it.
The first one is Asain or Hassane at each line and you can use to pull quotes to the multiline comments.