Interviews4 answers
Is indentation required in python?
4 Answers
Yes, python is very sensible about indentation, if code is not properly indented it won't be executed, as python doesn't have brackets to separate code segments then it is necessary to indent pretty well
Улисзс РикоPosted Sep 11, 2019, 9:25 AM EDT
Yes, indentation is required in python language.
Md SarfarajPosted Jul 23, 2019, 10:40 PM EDT
identation is the mechanism by which a code block is represnted in python. Unlike languages like Java or C++ where the code block is represented by curly braces, in python the need of putting and montitoring the start and end of barces was elemenated
Since there is no other way of representing code block, hence the need of indentation becomes unavoidable
For Example:
Java
int add(iint a, int b){return a+b;}
Python
def sum(a,b):return a+b
Rohit GuptaPosted Jul 14, 2019, 11:31 PM EDT
Yes, Where in other programming languages the indentation in code is for readability only, in Python the indentation is very important.
Python uses indentation to indicate a block of code.
Example:
if 5>2:print("five is greater than two")
Bidyasagar MishraPosted Jul 4, 2019, 8:48 PM EDT



