Python Comments Tutorial | Types of Python Comments
The ability to comment on the source code appears in all programming languages. A comment is a non-executable line of text, this means that the compiler or interpreter will not take it as a line of code. the comments. In Python, as well as in other programming languages, they serve to leave small explanations about what the program does. We know that it is very difficult to remember every aspect of our program, especially when we work on long and complicated projects. Python, being a simple language in syntax issues, helps us to properly document our code without much effort. This is a necessary practice and good developers will make great use of comments. Without this, the source code can get confusing really fast.
Let's see examples:
# This is a comment in Python
>>> function_1 ( )
>>> funcion_2 ( ) # Comments can also be after an executable text
# This is another comment in Python.
# You can have so many single line comments in a row.
"" "This is a multi-line comment.
We can write as many lines as we want by way of documentation. "" "
function_3 ( )
function_4 ( )
'' 'We can also make multi-line comments with single quotes.' ''.
Get to know more about the impact of Python on various domains by being a part of the best Python training institute in Bangalore.
Types of Python Comments:
In Python make comments in two ways. Writing the numeral symbol (#) at the beginning of the line of text where we want our comment. By typing triple quotation marks (') at the beginning and end of the comment , in this case the comments may occupy more than one line.
Let's see examples:
Single line comments in Python
# This is a comment in Python
>>> function_1 ( )
>>> funcion_2 ( ) # Comments can also be after an executable text
# This is another comment in Python.
# You can have so many single line comments in a row.
Multi-line comments in Python:
"" "This is a multi-line comment.
We can write as many lines as we want by way of documentation. "" "
function_3 ( )
function_4 ( )
'' 'We can also make multi-line comments with single quotes.' ''.
Get to know more about the impact of Python on various domains by being a part of the best Python training institute in Bangalore.
Thanks for sharing this post.
ReplyDeleteIntelliMindz is the best IT Training Institute, offering 200 and more software courses with 100% Placement Assistance.
Python Course in Bangalore
Python Course in Chennai
Python Course in Coimbatore
Python Training in Tirupur
Python Online Course
Python Course In Coimbatore
DeleteDigital Marketing Course In Coimbatore
sap mm training In Coimbatore
IntelliMindz is the best IT Training in Coimbatore with placement, offering 200 and more software courses with 100% Placement Assistance.
DevOps Course In Bangalore
ReplyDeleteDevOps Online Training
DevOps Training in chennai