Python uses indentation to indicate a block of code.

Leading whitespace (spaces and tabs) at the beginning of a statement is called indentation. 

  • In Python, the same level of indentation associates statements into a single block of code. 
  • The interpreter checks indentation levels very strictly and throws up syntax errors if indentation is not correct. 
  • It is a common practice to use a single tab for each level of indentation.
  • Python uses indentation for block as well as for nested block structures.
Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.