0
What is identation block??
2 ответов
+ 2
Indentation block refers to the lines of code that have equal amount of empty space in the beginning. Usually 4 whitespaces. In python, this is used to group together multiple lines of code under a one common line of code. For example, a block of code that should be executed if a value is true should be indented compared to the if line.
if this == True:
do whatever
do whateverelse
print(“python is great”)
In the python code above, the second and third lines are indented to indicate that they are part of the same block that is run only if the variable “this” is true. The last line is not indented and therefore is not part of the same block.
Indentations are also used in loops and functions and it can be thought of as a way of determening the hierarchy of the code in python. Most other programming languages use brackets to determine this hierarchy.
+ 1
Full explanation here check this.
https://www.python-course.eu/python3_blocks.php