Comments

Comments are little texts that can be added in code. They are created for programmers to read, not computers.  A comment is simply one or more lines of text that is not executed by the computer.

There are two ways to comment in Python:
single-line comments and multi-line comments.

 
Related Courses

Single line comment

A single line comment starts with the number sign (#) character:

For each line you want to comment, put the number sign (#) in front.

Comments should help other software developers, not be obvious like:

typical code comments

Multiline comment

Multiple lines can be created by repeating the number sign several times:

but this quickly becomes impractical.  A common way to use comments for multiple lines is to use the (”’) symbol: