Comments in Python - Python for Data Analytics

Python Programs | Python Tricks | Solution for problems | Data Cleaning | Data Science

Comments in Python

In Python, there are two ways to annotate your code.
The first is to include comments that detail or indicate what a section of code – or snippet – does.
The second makes use of multi-line comments or paragraphs that serve as documentation for others reading your code and starts with triple quotes(''') and end with triple quotes(''').

Think of the first type as a comment for yourself, and the second as a comment for others. There is not right or wrong way to add a comment, however. You can do whatever feels comfortable.

Single-line comments are created simply by beginning a line with the hash (#) character, and they are automatically terminated by the end of line.

example of single-line comment:
*******************************************

#This is single-line comment in Python

********************************************

example of Multi-line comment:
********************************************
'''
This is
a multiline
comment
'''

*************************************************

2 comments:

  1. Thank you for providing useful information and this is the best blog for the students.learn Python programming training course.
    Python Training in Hyderabad

    ReplyDelete
  2. Thank you for sharing such a valuable article with good information in this blog.learn Data science course with advanced technology.
    Data Science Training in Hyderabad

    ReplyDelete