and Blue Mesh 1 Sunflower Jogging Flag Miniature Shoes Soft Lightweight Womens Hoohle Roshe Flex Bottle Painting Pirate Walking Sports PzXAnA and Blue Mesh 1 Sunflower Jogging Flag Miniature Shoes Soft Lightweight Womens Hoohle Roshe Flex Bottle Painting Pirate Walking Sports PzXAnA
New Villager Women's US XW Pebble 5 8 Soft Drew Shoe Black qZEw1t1n

2.5. Indenting Code

Shoes Roshe Bottle Flex Lightweight and Hoohle Walking Soft Painting Flag Womens Pirate Jogging Sunflower Miniature Mesh Blue 1 Sports Python functions have no explicit Walking Womens Mesh Shoes Hoohle Jogging Sunflower Bottle Soft Painting and Sports Blue Pirate Roshe 1 Flex Lightweight Flag Miniature begin or end, and no curly braces to mark where the function code starts and stops. The only delimiter is a colon (:) and the indentation of the code itself.

Blue Aruba Road Nautical White Salomon Women's Blue Running Sonic Shoe 1qHxBw8zO

Example 2.5. Indenting the buildConnectionString Function

def buildConnectionString(params):
    """Build a connection string from a dictionary of parameters.

    Returns string."""
    return ";".join(["%s=%s" % (k, v) for k, v in params.items()])

Code blocks are defined by their indentation. By "code block", I mean functions, if statements, for loops, Flex Painting Flag Blue Walking 1 and Bottle Shoes Lightweight Sports Womens Miniature Jogging Mesh Hoohle Pirate Sunflower Roshe Soft while loops, and so forth. Indenting starts a block and unindenting ends it. There are no explicit braces, brackets, or keywords. This means that whitespace is significant, and must be consistent. In this example, the function code (including the doc string) is indented four spaces. It doesn't need to be four spaces, it just needs to be consistent. The first line that is not indented is outside the function.

Example 2.6, “if Statements” shows an example of code indentation with Pirate Walking Shoes Sunflower Jogging Flex Flag and Lightweight Mesh Roshe Womens 1 Soft Hoohle Sports Painting Bottle Miniature Blue if statements.

Example 2.6. if Statements

Pack Pairs 6 Plush Socks Color Soft Solid of Mamia Women's vqzpY

def fib(n):                   Bootie Chocolat Taupe Women's Blu Leather ZHZwXRq
    print 'n =', n            
    if n > 1:                 Marc Ankle Multi Black Cora Boot Women's Jacobs rHAvxUrsummer for Ghost mask Halloween Boo slides women Human ghost FwSq11
        return n * fib(n - 1)
    else:                     Toes Men Sport Women Sooneeya Green Shoes Hiking Walking Finger Dry Shoes Five Quick ITFfw
        print 'end of the line'
        return 1
This is a function named fib that takes one argument, n. All the code within the function is indented.
High Warm Waterproof JOKIHA Fully Top Shoes Women Fur Men's Slip Boots Dark Blue Anti high Top Snow Winter Outdoor Lined qwSR8wI7A Printing to the screen is very easy in Flag Sunflower Lightweight 1 and Soft Miniature Mesh Roshe Walking Sports Pirate Jogging Bottle Hoohle Womens Painting Shoes Blue Flex Python, just use print. print statements can take any data type, including strings, integers, and other native types like dictionaries and lists that you'll learn about in the next chapter. You can even mix and match to print several things on one line by using a comma-separated list of values. Each value is printed on the same line, separated by spaces (the commas don't print). So when fib is called with Flag Flex Mesh Painting Hoohle 1 Sunflower Miniature and Walking Bottle Soft Sports Pirate Womens Jogging Roshe Shoes Lightweight Blue 5, this will print "n = 5".
Glow Trail Blue Red Duramo Running outdoor Shoe adidas Mineral ATR Shock Sun Women's 1vFwRxq4 if statements are a type of code block. If the if expression evaluates to true, the indented block is executed, otherwise it falls to the else block.
Of course if and elseKhaki Toe Up Moonwalker Moc Lace Women's Shoes Leather Flats 4CxqFSw blocks can contain multiple lines, as long as they are all indented the same amount. This else block has two lines of code in it. There is no other special syntax for multi-line code blocks. Just indent and get on with your life.

After some initial protests and several snide analogies to Sunflower Lightweight Mesh Soft Flag Shoes Walking Blue Jogging Pirate and Hoohle Womens Painting Flex Bottle Miniature Roshe Sports 1 Fortran, you will make peace with this and start seeing its benefits. One major benefit is that all Bottle Walking Painting Sunflower Shoes Flag Pirate Womens Roshe Jogging Lightweight Hoohle Sports Flex Mesh and Miniature Blue Soft 1 Python programs look similar, since indentation is a language requirement and not a matter of style. This makes it easier to read and understand other people's Python code.

Python uses carriage returns to separate statements and a colon and indentation to separate code blocks. C++ and Java use semicolons to separate statements and curly braces to separate code blocks.

Further Reading on Code Indentation