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.
single-line comments and multi-line comments.
Single line comment
A single line comment starts with the number sign (#) character:
# This is a comment print('Hello')
For each line you want to comment, put the number sign (#) in front.
# print('This is not run') print('Hello')
Comments should help other software developers, not be obvious like:
Multiple lines can be created by repeating the number sign several times:
# This is a comment # second line x = 4
but this quickly becomes impractical. A common way to use comments for multiple lines is to use the (”’) symbol:
''' This is a multiline Python comment example.''' x = 5