Comments

Comments are used to add remarks or note in the source code. Comments are not executed by

interpreter. They are added to understand the source code for others. They are used primarily to

document the meaning and purpose of source code and its input and output requirements, so as

to remember later how it functions and how to use it.


For large and complex software, several programmers are working in teams and sometimes, a

programmer has to work on the program written by other programmer. In such situations,

documentations in the form of comments is useful to understand the logic of program. In Python,

a comment starts with # (hash sign). Everything following the # till the end of that line is treated

as a comment and the interpreter simply ignores it while executing the statement. The example

10.1 shows the first print statement is commented. So it will not print the word ―Hello‖.