O'Reilly logo

XML Processing with Python by Sean McGrath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.2. Basic Control Structures

Python's WYSIWYG code layout philosophy is at the core of how Python programs are constructed. Control structures such as code repetition and code selection use indentation to express the grouping of code statements.

In this section, we talk a little about the philosophy behind this WYSIWYG approach and then look at the most important control structures provided by Python.

5.2.1. Some WYSIWYG Code Layout Philosophy

Here is a simple algorithm in the C programming language that uses braces to control statement grouping. Languages such as C++, Perl, and Java™ also take this general approach to statement grouping.

 CD-ROM reference=5001.txt while (alive) { if (hungry) { eat(); if (thirsty) { drink(); } } else { WriteSoftware(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required