How does Python use indentation?

Python basics · Freshers

Model answer

Indentation defines blocks of code, such as the body of an if, loop or function, instead of curly braces. The convention is four spaces. Mixing tabs and spaces or wrong indentation causes an IndentationError.

Learn this topic

What Is Python? Install It and Write Your First Program in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions