Python Comments

Python Comments

What are comments in python?

Comments are lines or lines of codes that the programmer does not want to execute. Comments are written in the program for hints and to indicate what this line of code do.


Types of comments.

There are two types of comments in python :
  1. Single-line comment
  2. Multi-line comment

Single-line comment :

Single-line comment allow to comment a single line of code or hint. To comment a single line, write hash sign ( # ) at the beginning of the line. For example # This is a  comment (shown below).



Multi-line comment :

Multi-line comments allow to comment more than one line of code or hints. To comment multiple lines, write your comment between triple quote ( '''   ''' ). For example ''' This is a comment '''. Shown below.



Where do you live? Tell your answer in comment section by using python single-line or multi-line comment.

Comments