Unit 02 — Python Programming Fundamentals¶
Welcome to the first programming unit of the course. In this unit, we will learn how to express instructions with Python, execute them in different environments and use evidence to decide whether a program behaves as intended.
Python is widely used in engineering, management, data analysis, automation and artificial intelligence. It is also an excellent first programming language: its syntax lets us concentrate on the ideas behind a program without hiding the need for precision, testing and clear reasoning.
During the unit, we will use two complementary environments:
Google Colab for guided notebooks, short experiments and classroom work;
Visual Studio Code with local Python and Jupyter for projects, files, Git and governed AI assistance.
We will also use Git and GitHub to preserve the history of our work. Gemini and Cline may support learning during class, but their suggestions must follow the assistance level defined for each activity and must always be understood, tested and explained by the student.
Unit learning objectives¶
By the end of the unit, you should be able to:
distinguish source code, a programming environment and an execution environment;
write and execute Python instructions in notebooks and scripts;
call built-in and library functions and import Python modules;
represent program state with variables and basic data types;
construct numeric expressions and convert values deliberately;
express decisions with Boolean expressions and conditional structures;
repeat operations with
for,range()and lists;construct and represent a simple numeric series;
use Git to record and publish meaningful versions of your work;
use AI assistance responsibly and verify every adopted suggestion.
The recurring learning cycle is:
predict → execute → compare → explain
How to use this page¶
Each session contains:
the scheduled date and learning focus;
the presentation used in class;
the follow-along and practice materials, when applicable;
related tutorials for preparation, review or further study.
Session 03 — Course environment, Git and governed AI¶
Date: 14 September
Focus: Prepare the complete course workflow: Colab, local Python and Jupyter, Visual Studio Code, Git, GitHub, Gemini and Cline.
In this practical onboarding session, we will create a first Python notebook,
export it as .ipynb and .py, execute both versions locally and publish the
initial course workspace to a private GitHub repository. We will then compare AI
assistance with and without the course tutor configuration.
Presentation¶
Class materials¶
Visual Studio Hello world: Read this to download the Notebook and run it in your local environment.
Course workspace template: Download the governed workspace, initialise its Git history and publish it as a private student repository.
Session 04 — Python execution, functions and libraries¶
Date: 17 September
Focus: Understand how Python and notebook execution work, call available functions and use Python libraries without defining functions of our own yet.
We will reason about instructions, literals and sequential execution; observe notebook state and kernel restarts; identify function calls and arguments; use initial built-in functions; install a package; import modules in different ways; and read simple syntax and runtime errors.
Presentation¶
Class materials¶
Session 04 follow-along: Guided exploration of execution, built-in functions, packages, imports and errors.
Session 04 practice: Reinforcement, code review and certification-style scenarios.
Related tutorials and extra materials¶
Built-in Functions: Reference and examples for commonly used Python functions.
Hello World in Visual Studio Code: Run a simple Python program locally.
Jupyter Notebook Hello World: Review notebook cells and execution.
Session 05 — Variables, types and numeric operations¶
Date: 18 September
Focus: Represent changing program state and construct meaningful numeric expressions.
We will introduce variables, assignment and reassignment; distinguish int,
float and str; use arithmetic operators; reason about precedence and
parentheses; convert input values; and identify code that executes but loses
necessary information or precision.
Presentation¶
Class materials¶
Session 05 follow-along: Guided reasoning about values, types, assignment, operators and conversions.
Session 05 practice: State tracing, numeric problems, AI-generated code review and exam-style decisions.
Related tutorials and extra materials¶
Variables: Variables, basic data types and introductory examples.
Basic Operators: Arithmetic operators, expressions and precedence.
Variables and Basic Operations exercises: Additional independent practice.
Variables code cards: Short retrieval and code-reading activities.
Session 06 — Boolean expressions and selection control flow¶
Date: 23 September
Focus: Model decisions with Boolean values, comparisons and conditional branches.
We will construct and trace comparisons; store Boolean program state; combine
conditions with and, or and not; select actions with if, if-else and
if-elif-else; and test condition order, coverage and boundary values.
Presentation¶
Class materials¶
Session 06 follow-along: Guided construction of an event check-in decision system.
Session 06 practice: Comparisons, conditional programs, code review and applied scenarios.
Related tutorials and extra materials¶
Basic Control Structures: Boolean expressions and conditional control flow.
Basic Control Structures exercises: Additional exercises with decisions and conditions.
Basic control structure cards: Short code-reading and prediction activities.
Control structures exercise cards: Printable review exercises.
Session 08 — Loops, lists, series and visualisation¶
Date: 30 September
Focus: Repeat operations, preserve successive results and represent an ordered series graphically.
We will introduce iterables, for, range(), lists, integer indexing,
append() and accumulators. We will construct a simple numeric series, locate
positions that require attention and create an introductory Matplotlib plot.
Slicing and functions defined with def are deliberately reserved for later
sessions.
Presentation¶
Class materials¶
Session 08 follow-along: Build and plot the evolution of a monthly savings plan.
Session 08 practice: Trace loops, construct lists and series, review code and solve applied scenarios.
Related tutorials and extra materials¶
Iterable Objects I: Introductory iterable objects and lists.
For Loops: Repetition with
forand membership within.Iterables exercises: Additional practice with collections and loops.
Control Structures and Iterables follow-along: Optional integrated review of decisions and repetition.
Additional unit resources¶
Programming with Co-pilot: Historical AI-assistance material; compare its recommendations with the current governed workflow.
Development Tools: Additional information about development tools and workflows.
Functions and variable lifecycle code cards: Optional review connecting calls, variables and program state.
After Session 08, the course moves temporarily to Arduino and communications. Python resumes in Unit 04 with function definitions, advanced iterables, NumPy, structured data and Pandas.