Python: Comments

♠ Posted by Unknown in at 01:45

Comments in Python


In Python, comments are preceded by a pound sign (#) on a line, called a line comment, or enclosed between three consecutive single quotation marks (''') on one or several lines, called a paragraph comment. When the Python interpreter sees #, it ignores all text after # on the same line. When it sees ''', it scans for the next ''' and ignores any text between the triple quotation marks.

For Example:

# This program displays one message


''' This program displays
   Two messages
'''

Line Continuation Symbol in Python

In some cases, the Python interpreter cannot determine the end of the statement written in multiple lines. We can place the  line continuation character (\) at the end of the line to tell the interpreter that the statement is continued on the next line. For example, the following statement

fact = 1 * 2 * 3 * 4 * \
          5 * 6
is equivalent to
fact = 1 * 2 * 3 * 4 * 5 * 6

6 comments:

Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
Best Dental Clinic In Chennai

This is a very interesting web page and I have enjoyed reading many of the articles and posts contained on the website, keep up the good work and hope to read some more interesting content in the future.
Digital Marketing Training in Chennai
Web Designing Training in Chennai

Really Good blog post about python.provided a helpful information.I hope that you will post more updates like this.
Informatica Training in Chennai

This is extremely helpful info!! Very good work. Everything is very interesting to learn and easy to understood.Interesting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...
Digital Marketing Company in India

Good Post. I like your blog. Thanks for Sharing
Python Training in Gurgaon

Post a Comment