We end each chapter with a summary of the main points (i.e., TL;DR = "too long; didn't read"). The essence in this first chapter is that just as a sentence in a real language like English may be decomposed into its parts (e.g., subject, predicate, and objects), the same may be done with programming languages.
program
- sequence of instructions that specify how to perform a computation (= a "recipe")
- a "black box" that processes inputs and transforms them into meaningful outputs in a deterministic way
- conceptually similar to a mathematical function f that maps some input x to an output y=f(x)
input (examples)
- data from a CSV file
- text entered on a command line
- data obtained from a database
- etc.
output (examples)
- result of a computation (e.g., statistical summary of a sample dataset)
- a "side effect" (e.g., a transformation of raw input data into cleaned data)
- a physical "behavior" (e.g., a robot moving or a document printed)
- etc.
objects
- distinct and well-contained areas/parts of the memory that hold the actual data
- the concept by which Python manages the memory for us
- can be classified into objects of the same type (i.e., same abstract "structure" but different concrete data)
- built-in objects (incl. literals) vs. user-defined objects (cf., Chapter 11
)
- e.g.,
1
, 1.0
, and "one"
are three different objects of distinct types that are also literals (i.e., by the way we type them into the command line Python knows what the value and type are)
variables
- storage of intermediate state
- are names referencing objects in memory
- e.g.,
x = 1
creates the variable x
that references the object 1
operators
- special built-in symbols that perform operations with objects in memory
- usually, operate with one or two objects
- e.g., addition
+
, subtraction -
, multiplication *
, and division /
all take two objects, whereas the negation -
only takes one
expressions
- combinations of variables (incl. literals) and operators
- do not change the involved objects/state of the program
- evaluate to a value (i.e., the "result" of the expression, usually a new object)
- e.g.,
x + 2
evaluates to the (new) object 3
and 1 - 1.0
to 0.0
statements
- instructions that "do" something and have side effects in memory
- (re-)assign names to (different) objects, change an existing object in place, or, more conceptually, change the state of the program
- usually, work with expressions
- e.g., the assignment statement
=
makes a name reference an object
comments
- prose supporting a human's understanding of the program
- ignored by Python
functions (cf., Chapter 2
)
- named sequences of instructions
- the smaller parts in a larger program
- make a program more modular and thus easier to understand
- include built-in functions
like print()
, sum()
, or len() 
flow control (cf., Chapter 3
and Chapter 4
)
- expression of business logic or an algorithm
- conditional execution of parts of a program (e.g.,
if
statements)
- repetitive execution of parts of a program (e.g.,
for
-loops)