I l@ve RuBoard |
In this chapter, we explored Python's basic procedural statements:
Assignments store references to objects.
Expressions call functions and methods.
print sends text to the standard output stream.
if/elif/else selects between one or more actions.
while/else loops repeat an action until a test proves false.
for/else loops step through the items in a sequence object.
break and continue jump around loops.
pass is an empty placeholder.
We also studied Python's syntax rules along the way, looked at Boolean operators and truth tests, and talked a little about some general programming concepts in Python.
By combining basic statements, we are able to code the basic logic needed to process objects. In Chapter 4, we move on to look at a set of additional statements used to write functions, which package statements for reuse. In later chapters, we'll see more statements that deal with bigger program units, as well as exceptions. Table 3.5 summarizes the statement sets we'll be studying in the remaining chapters of this part of the book.
Unit |
Role |
---|---|
Functions |
Procedural units |
Modules |
Code/data packages |
Classes |
New objects |
Exceptions |
Errors and special cases |
I l@ve RuBoard |