CODE-BLOCKS in Python
CODE-BLOCKS in Python
Code Blocks
It is very important to understand how to write code blocks in
Python. Let’s look at two key concepts around code blocks.
Indentation
One of the most unique features of Python is its use of indentation to
mark blocks of code.
Each line of code must be indented by the same amount to denote a
block of code in Python. Indentation is required to indicate which
block of code a code or statement belongs to.
Suits
A collection of individual statements that makes a single code block
are called suites in Python.
A header line followed by a suite are required for compound or
complex statements such as if, while, def, and class (we will
understand each of these in details in the later sections).
Examples:
# Correct indentation
# One TAB (or a continuous four white spaces) is the standard
indentation
print("Python is important for Data Science")
print("Pandas is important for Data Science")