


Code must be carefully indented with proper number of whitespace and ensure that whitespaces' uniformity is maintained in a single block.a block of code is represented by curly braces errors that sometimes popup in C, C++ languages can be avoided in python also the number of lines of code is reduced. So whereas in languages like C, C++, etc. Python treats the statements with the same indentation level (statements with an equal number of whitespaces before them) as a single code block. The reason why indentation is important in python is that the indentation serves another purpose other than code readability. Indentation is the leading whitespace ( spaces or/and tabs) before any statement in Python. Then, we will discuss some advantages and disadvantages of indentation.

We will learn a few rules on indentation with some example codes.In this topic, we are going to learn about Indentation in Python.Indentation in other languages like C, C++, etc., is just for readability, but in Python, the indentation is an essential and mandatory concept that should be followed when writing a python code otherwise, the python interpreter throws IndentationError. Indentation in Python is simply the spaces at the beginning of a code line.
