Tell me more about indentation in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Tell me more about indentation in python

Explain me all the rules of indentation in a python program like the way that is used in loops and all thanks

5th May 2018, 4:41 PM
Devansh Gupta
Devansh Gupta - avatar
2 Answers
+ 2
4 spaces or one tab. preferably the first or an ide that considers a tab as 4spaces indent on classes, functions, loops, statements
5th May 2018, 5:31 PM
Markus Kaleton
Markus Kaleton - avatar
0
Python doesn’t use braces and semicolons the way other C based languages do. Since it doesn’t, it has to use something to know what code should be blocked off for use. As stated above, python considers every 4 space indentation as a sub block of code.
6th May 2018, 1:28 AM
Mike Shaw
Mike Shaw - avatar