Lines and Indentation
Introduction
The program is consists of a block of code. Each block has a group of statements in a program or script. Usually, it consists of at least one statement and of declaration for the block, depending on the programming or scripting language.
Block structured language
A language, which allows grouping with blocks, is called block-structured language such as Java, PHP, C#, Python, etc. Generally, one block can contain another block. So, we get a nested block structure. A block in a script or program functions as a means to group statements to be treated as if they were one statement. In many cases, it also serves as a way to limit the lexical scope of variables and functions.
Most of the languages use braces to indicate blocks of code for class and function definitions or flow control. Python programs get structured through indentation which is code blocks are defined by their indentation. Blocks of code are denoted by line indentation, which is rigidly enforced. The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount.
Example

Statement in Python typically ends with a new line. Python does, whenever, allow the use of the line continuation character (\) to denote that the line should continue.
Example1
Example2
Statements contained within the [],{}, or () brackets do not need to use the line continuation character.
Example1
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.
Example
Comments in Python
A comment is a sentence or paragraph which describes the statement of the block or program. It is not executed by the interpreter. It helps to understand the program to other programmers.
Example
Using Blank Lines
A line containing only whitespace, possibly with a comment, is known as a blank line and Python totally ignores it. In an interactive interpreter session, you must enter a physical line to terminate a multiline statement.
Multiple Statements on a single line
The semicolon (;) allows multiple statements on the single line given that neither statement starts a new code block.
Example
Post a Comment