Python 3 Comment Function. | pycoder
Python3 Comments Function.
When the program is getting bigger and more complicated,it is getting difficult to read and maintain. For these reasons, it is a good practice to put some documentations or notes into your code. These notes are called comments.
The code only can tell you how it does but cannot tell you why it does so. However, your comment can do that. You use comments to explain formulas, complex algorithms and sophisticated business logic.
Python Block Comments
you use a block comment to explain the code that follows it. A block comments is indented at the same level as the code block. To write a block comment, you start with a single hash (#) sign followed by single space and comment.
The Following Code illustrates how to make a block:
1 # single line comment
2 print ('Hello World')
Multi-line docstrings
As its name implies, multi-line docstrings can span multiple lines. Just like one-lined docstrings, the first line of multi-line docsstring is a summary, followed by a blank line and of course more description underneath.
The Followin example shows you how to use multi-line docstrings:
""" multi-line docs string
like this use double qouts
and single qouts """
When the program is getting bigger and more complicated,it is getting difficult to read and maintain. For these reasons, it is a good practice to put some documentations or notes into your code. These notes are called comments.
The code only can tell you how it does but cannot tell you why it does so. However, your comment can do that. You use comments to explain formulas, complex algorithms and sophisticated business logic.
Python Block Comments
you use a block comment to explain the code that follows it. A block comments is indented at the same level as the code block. To write a block comment, you start with a single hash (#) sign followed by single space and comment.
The Following Code illustrates how to make a block:
1 # single line comment
2 print ('Hello World')
Multi-line docstrings
As its name implies, multi-line docstrings can span multiple lines. Just like one-lined docstrings, the first line of multi-line docsstring is a summary, followed by a blank line and of course more description underneath.
The Followin example shows you how to use multi-line docstrings:
""" multi-line docs string
like this use double qouts
and single qouts """
No comments: