Python Programming Foundations – Study Notes
Section 1: From Ideas to Programs
We begin with the idea of a recipe for solving a problem and basic knowledge of what exists inside a
computer. The objective is to convert a conceptual process into a precise set of instructions that a
machine can execute.
A programming language provides primitive operations and rules for combining them into expressions.
An expression is a legal combination of primitives that represents a computation. Every valid
expression has a value, which represents its meaning.
Programming languages consist of: - Primitives - Means of combination - Means of abstraction
Syntax determines whether an expression is legally structured. Semantics determines the meaning of
that expression.
Errors may be: - Syntax errors - Static semantic errors - Logical errors (bugs)
Our goal is to learn Python syntax and semantics to translate problem-solving recipes into executable
programs and to develop reusable patterns of computational thinking.
Section 2: Expressions, Objects, and Operations in Python
A Python program consists of definitions and commands. Definitions assign names or create
procedures. Commands are executed immediately in the Python shell.
Programs manipulate data objects. Every object has a type that determines what operations are
allowed.
Scalar types in Python include: - int - float - bool - NoneType
The type() function reveals an object's type. Python supports type casting between numeric types.
Expressions follow the form: object operator object
Arithmetic operations include: - Addition (+) - Subtraction (-) - Multiplication (*) - Division (/) - Integer
division (//) - Modulo (%) - Exponentiation (**)
Operator precedence follows this order: 1. Exponentiation 2. Multiplication / Division 3. Addition /
Subtraction
Parentheses override precedence and control evaluation order. Complex expressions are evaluated
from the inside out.
These concepts form the foundation for building correct and meaningful Python programs.