0
If we don't use indentation in if statement then what happens in code?
Phython
6 Answers
+ 2
Apoorv Bansal
Simply you should look at it's advantage
To indicate a block of code in Python, you must indent each line of the block by the same amount. The two blocks of code in our example if-statement are both indented four spaces, which is a typical amount of indentation for Python.
+ 2
Alright. Here a complete (I hope) overview of indentation:
https://code.sololearn.com/cT5BRIbkia21/?ref=app
+ 1
If you don't indent in Python, you'll get an error.
(Why don't you try it?)
0
piyush singh it is not a must.
Example:
indent = 4
if indent == 4: indent += 4
else: indent *= 5
print(indent)
Output ==> 8
The above code would work fine without indentation. It just doesn't follow the PEP rules that's all.
0
Tomiwa Joseph mentioned in description (about what language he is asking)đ
0
piyush singh He just edited itđđ