Python Comments And It's Classification

Comments :

Comment is a line of text that appears in a program but it does not execute when run the code. 
Comments used to explain the code in program.
Comments used to make the code more readable.

Classification Of Comments :

There are two types of comment in python
  • Single Line Comment 
  • Multi Line Comment

Single Line Comment :

We create a single line comment in Python using a hash (#) symbol at begining of the line.

In the above program '#Python Hello World Program' is a single line comment, because it begins with '#' symbol.

Multiline Comment :

We create a Multi Line Comment in Python using three double quote (""") or three single quote ("') at begining and end of the line.

In the above example 'Create python program to print Hello World as output' is a comment because, it is begins and end with three double quotes (""") and 'Create python program to print Hello World as output' also a comment because it is begins and end with three single quotes (''').

Post a Comment

0 Comments