Python does not use curly braces for code blocks:

>>> while True { File "<stdin>", line 1 while True { ^ SyntaxError: invalid syntax >>> from __future__ import braces File "<stdin>", line 1 SyntaxError: not a chance

(Notice the "not a chance" message – this is an Easter egg reflecting this design decision.)

As a language designed to be easy to use and read, Python uses colons and indentation to designate code blocks. Defining code blocks by indentation is unusual and can come as a surprise to programmers who are used to languages like C++ and C# because these (and many other languages) don't care about extra whitespace or indentation. This rule is intended to increase readability of Python code, at the cost of some of the programmer's freedom to use varying amounts of whitespace.

An increase in the indentation level indicates the start of a code block, while a decrease indicates the end of the code block. By convention, each indentation is four spaces wide.

Here's a simple example which sums all the integers from 0 to 9. Note that ranges in Python include the first value, up to but not including the last value: