Friday, 5 January 2018

Quotation & Comments in Python

Quotation in Python
Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string.
The triple quotes are used to span the string across multiple lines. For example, all the following are legal-
word = 'word'
sentence = "This is a sentence."
paragraph = """This is a paragraph. It is
made up of multiple lines and sentences."""

Comments in Python
A hash sign (#) that is not inside a string literal is the beginning of a comment. All characters after the #, up to the end of the physical line, are part of the comment and the Python interpreter ignores them.

#!/usr/bin/python3

# First comment
print ("Hello, Python!") # second comment

No comments:

Post a Comment

Lists

Python  Lists Python Collections (Arrays) There are four collection data types in the Python programming language: List  is a ...