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.
Go Ad-free
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 and Computer Science at Teachoo