+ 1

What is the role of identation in python?

5th Jan 2020, 5:58 AM
Pari
3 Answers
+ 4
Don't know much Python, but this far I have understood that indentation in Python structures the code, in that indentation is used to group multiple instruction into a block. Any instruction belonging to a block is written with deeper indentation than the block itself. I'm bad at this, hope someone can explain better : )
5th Jan 2020, 6:21 AM
Ipang
+ 3
Indentation helps to separate blocks of code (like for loops, if blocks and function definitions) to make it easy for the interpreter to know when a block ends. Other languages use curly braces and end statements to provide this information to the compiler. Code indentation also provides a much better way of providing the visual cues for humans about block structures while reading the lines of code.
5th Jan 2020, 7:12 AM
Peter
Peter - avatar