print('statement 1') print('statement 2') # ...
Statements are similar to sentences in natural languages.
Statement is a complete unit of execution.
print('statement 1'); print('statement 2'); print('statement 3');
Each line in Python forms a statement.
You can have multiple statements in one line by separating them using semicolons (
;) are optional and Not recommended in Python.
print ( 'statement 1' ) print ('statement 2') # Syntax Error print( 'statement 3' )
Unlike languages C and Java, indentations in Python are syntactically meaningful and form blocks.
Any other use of Whitespaces, as long as they don't make ambiguity, are ignored in Python.
age = 12 print(age) # 12 print(Age) # error PrinT(age) # error
Python is a Case Sensitive language.
def printStatements(): print('statement 1') print('statement 2')
Block is used to group one or more statements.
Blocks in Python are called Suites.
Suite is defined by using a group of statements with the same level of indentation.
Python doesn't support anonymous Blocks of code like C and Java.
Here, we are defining a function
printStatements with two statements.