Python Comments and Statements

We’ll discuss Python comments and statements in this section, as described below,

Python Comments

Comments are the chunks of lines that are ignored by the compiler during the compilation of the code.   Comments are valuable for understanding and clarification of the code.

In Python, hash (#) symbol is use to start writing a comment. Python allows single line as well as multiple line comments.

#Example:
#this is a comment
print ("hello world") #comment

Multi-line Comment:

We can extent the comments to the multiple lines.

One of the most common way is to use the hash(#) symbol at the beginning of each line.

And the other way to use multi-line comment is using triple quotes either ''' or “””

Python Statements

In a programming language, a statement is a syntactic unit that expresses some action to be carried out. A program written in such a language is formed by a sequence of one or more statements. A statement may have internal components.

Some types of statement are if statement, for statement, while statement etc.

Multi-line Statement:

n Python, the conclusion of a explanation is stamped by a newline character. But we are able make a explanation expand over different lines with the line continuation character (\).

Example using Continuation Character (\):

This is an unequivocal line continuation. In Python, line continuation is suggested interior enclosures ( ), brackets [ ], and braces { }.

Example using parentheses( ):

Here, these parentheses ( ) do the line continuation implicitly. Same is the case with [ ]and { }.

Example using square brackets[ ]:
Example using semicolons(;) :