![]() | ![]() |
Just like multi-line program statements we also have multi-line comments. There are several ways of writing multi-line comments. The first approach is to type the hash (#) at each comment line starting point.
For Example
Start IDLE.
Navigate to the File menu and click New Window.
Type the following:
#I am going to write a long comment line
#the comment will spill over to this line
#and finally end here.
The second way of writing multi-line comments involves using triple single or double quotes: ‘’’ or”. For multi-line strings and multi-line comments in Python, we use the triple quotes. Caution: When used in docstrings they will generate extra code, but we do not have to worry about this at this instance.
Example
Start IDLE.
Navigate to the File menu and click New Window.
Type the following:
“This is also a great
illustration of
a multi-line comment in Python.”