top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Writer's pictureRawda Rumaieh

Indentation

Wondering why when we as a kids missed the indentation in the writing class we lost marks?


what is this white space? why is it important?


assume writing different stories in a paper without dividing them into paragraph how can you ever understand that you already finished a story and starting a new one? indentation is the red flag that tells you STOP you are now entering a new clan.


Indentation in Python refers the space at the begging of the statement. The statements with the same indentation belong to the same group called a suite.


Since we are so cool that the interpreter imitates our actions, we understand that these lines are related to each other due to the indentation. Without indentation, Python does not know which statement to execute next or which statement belongs to which block.

Not understanding how indentation works will drive you to see the very famous error


INDENTATIONERROR

If python was not your first stop when learning to code you probably used {} to define your scopes like most of languages like C++ or java.

If you are the type of person who use nested for loops where your "On" is On^5 your code will simply be indented further to the right.