About indentation

Python uses indentation to delimit blocks of code. A block starts with a line ending in colon, and continues for all lines that have a similar or higher indentation as the next line. For example:

  1. >>> i = 0
  2. >>> while i < 3:
  3. ... print i
  4. ... i = i + 1
  5. ...
  6. 0
  7. 1
  8. 2

It is common to use four spaces for each level of indentation. It is a good policy not to mix tabs with spaces, which can result in (invisible) confusion.