comment in python

Comments In Python

Spread the love

In programming, comments are the readable texts in the source code which are completely ignored by compiler or interpreter. It helps the programmer to remember what tricky things s(he) did in the block of source code and it also helps others to understand the source code better. Comments can be anything like a description of the logic behind the code, your purpose of the program, Or sometimes in large programs, you can comment on the source code blocks to remember their individual function or purpose. comment in python is most important.

Not only in python but mostly in all programming languages. It is always a good practice to use comments in the code. It makes the source code neater and understandable.

In python hash character(#) is used to write comments. Any line starting from the # is considered as a comment and is ignored by a compiler or interpreter. It doesn’t affect the program.

There are two types of comment in python,
  • Single-line comment 

              These are usually helpful when you want to write the purpose of the code or what it does

  • Multi-line comment

These are helpful when you want to write the logic behind the code block/program 

In python, single-line comments start from the # and extend till the end of the physical line.

For Example,

Comments In Python

For a multi-line comment, you can start with triple single quote or double quote at start and at end.

Comments In Python

This is all about comment in python. Write comment in every code is such a good practice

Related article : Install Latest Version Of Python

If you have any questions DM me on Instagram


Spread the love
3 comments
  1. Hi, There’s no doubt that your web site could possibly be having web browser compatibility issues.Whenever I take a look at your web site in Safari,it looks fine however, if opening in I.E., it’s got some overlapping issues.I simply wanted to provide you with a quick heads up!Apart from that, wonderful site!

  2. You really make it seem really easy with your presentation but I to find this topic to be actually one thing which I think I might by no means understand. It seems too complicated and extremely wide for me. I’m looking ahead for your next put up, I will try to get the hang of it!

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

If-else In Python

Spread the love

Spread the love If-else in python used to check conditions. These statements are also used to make decisions. before we move further have a quick look at comparison operators, which…
Spread the love
View Post

Operators In Python

Spread the love

Spread the love Operators in python is a symbol that perform certain operation on one or more variable or a value. There are 7 types of operators in python Arithmetic…
Spread the love
View Post

Loops In Python

Spread the love

Spread the love There are 2 type of loops in python. for loop while loop Let’s have detailed information about loops in python. For loops in Python for loops in…
Spread the love
View Post