+ 1

[DUPLICATE] How is indenting done in Python

python

6th Jan 2018, 6:00 AM
Julius Ndegwa
Julius Ndegwa - avatar
2 Answers
6th Jan 2018, 7:36 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
You have to indent a logical block of code - a function definition, a loop, a block inside an if statement, etc. It is recursive, so nested loops get indented twice, nested nested loops thrice and so on. The depth of the single indentation is for you to pick (usually four spaces) but you have to be consistent throughout the code - if the single indentation is four spaces, then the double one is eight, triple one is twelve, etc.
6th Jan 2018, 7:01 AM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar