can some explain indentation and blocks | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can some explain indentation and blocks

Also please give some examples

25th Jun 2016, 1:29 PM
Mohammed
Mohammed - avatar
2 Answers
+ 4
indentation is a space at the beginning of a written line. Example: def greet(name): print 'Hello ', name greet('Jack') You see the space at the begining of print? That's it, and you have to do this in Python, if you want or not. It makes the code easier to read, actually.
26th Jun 2016, 2:06 AM
Cloud
+ 1
@Cloud : so its easier to spot out particular functions, you mean .. or just to actually only make it easier to read ? Cause I remember reading it somewhere that indentations are necessary to add in Python and not an "if you want or not thing" ? My question is purely based on the necessity of this. Thanks for replying mane !!
25th Jul 2016, 1:07 AM
Zayd Noor
Zayd Noor - avatar