Workshop 01 · Beginner · 120 min
Python Foundations: Build Inbox Guardian
Core Python Programming & Rule-Based Message Analysis
A step-by-step introduction to Python syntax, branching, loops, collections, and functions, ending with a rule-based email security analyzer.
8-chapter curriculum
Step-by-step progression from core ideas to working implementation
Introduction to Python and the Coding Environment
Welcome to the Center of Excellence's Python, Data Science & Machine Learning Workshop Series. Python has become the lingua franca of computational science, artificial intelligence, automated reasoning, and backend infrastructure. In this foundational chapter, you will deconstruct how computers execute code, how the Python interpreter transforms human-readable text into machine instructions, and how to write, format, and debug fundamental Python statements.
Variables, Data Types and Input/Output
Data science and artificial intelligence rely on representing, transforming, and processing real-world data in memory. In this chapter, you will master Python's memory model: how variables act as dynamic references to objects, how to distinguish primitive types (int, float, str, bool, NoneType), how to cast types safely, how to accept interactive user input with input(), and how to construct modern, formatted strings with f-strings.
Strings and Text Processing
Text is the most ubiquitous data format in computer science—from web traffic and email payloads to genomic sequences and large language model corpora. In this chapter, you will master the mechanics of Python strings: zero-based indexing, slicing with step strides, immutability, essential string cleaning methods, tokenization with split and join, and fast substring scanning. These techniques directly empower our Inbox Guardian security engine.
Conditional Logic and Decision Making
Intelligent computer systems must make decisions: should this transaction be flagged as fraud? Does an email contain phishing characteristics? Should a self-driving vehicle apply the brakes? In this chapter, you will master Python's conditional logic: boolean truth values, comparison and identity operators, logical operators with short-circuit evaluation, the if-elif-else decision tree, and clean Pythonic guard clauses.
Loops and Repetition
Computers excel at executing repetitive computations millions of times with unflinching precision. Whether iterating through thousands of email records, calculating statistical sums across tabular datasets, or running simulated time steps, loops are essential. In this chapter, you will master Python's loop constructs: definite iteration with for-loops and the range() generator, condition-driven iteration with while-loops, loop control flow using break and continue, the unique loop-else construct, and the accumulator pattern.
Collections: Lists and Dictionaries
Data science and AI rarely operate on isolated numbers or single strings. Real-world systems process collections of data: tables of records, matrices of features, database rows, and JSON payloads from web APIs. In this chapter, you will master Python's two most essential composite data structures: ordered mutable Lists and associative key-value Dictionaries. You will also learn how combining them into 'lists of dictionaries' forms the universal in-memory data model.
Functions and Code Organisation
As software grows in complexity, writing code as one continuous monolithic script becomes unmaintainable. Professional software architecture relies on decomposition: breaking complex workflows into small, isolated, testable, and reusable blocks called Functions. In this chapter, you will master function engineering: parameter passing, positional vs keyword arguments, the critical mutable default argument trap, return value contracts, local vs global scope, type annotations, and docstrings.
Capstone Project: Build Inbox Guardian
CapstoneYou have arrived at the flagship capstone milestone of Workshop 1. Rather than writing disconnected toy scripts, you will now synthesize all 7 chapters—variables, types, string methods, branching conditions, loops, structured collections, and modular functions—into an end-to-end command-line application: INBOX GUARDIAN. You will architect, implement, test, and debug a rule-based email threat scanner capable of parsing raw messages, extracting structural heuristics, computing weighted risk scores, and generating security quarantine verdicts.
Capstone project
Inbox Guardian: rule-based message security scanner
Synthesize all eight chapters into a working command-line scanner that normalizes email text, matches suspicious keywords, scores structural heuristics, and outputs quarantine verdicts.
Apply .lower() and .strip() to handle inconsistent casing and whitespace.
Check messages against financial lures, deadlines, and threat terms.
Measure uppercase ratio and punctuation density for an aggregate score.
Classify inboxes into safe, flagged, or quarantine verdicts.
- String slicing & normalization
- Conditional branching (if / elif / else)
- Iteration over message collections
- Structured dictionaries for scoring
- Modular functions with return contracts
Measurable competencies
- 01Understand the Python execution model and write structured, error-free Python programs
- 02Work confidently with fundamental data types, type conversions, and formatted strings
- 03Manipulate and inspect text using string indexing, slicing, and built-in text methods
- 04Implement branching decision logic using comparison and logical operators with short-circuiting
- 05Automate repetitive tasks with for-loops, while-loops, enumerate(), and range generators
- 06Structure structured in-memory datasets using lists, dictionaries, and nested collections
- 07Design modular, reusable functions with parameters, return statements, and local scopes
- 08Architect, implement, and test Inbox Guardian — a complete rule-based email threat scanner
Prerequisites & environment
- No prior programming experience required
- Basic computer literacy and a modern web browser
Further reading
Programiz Python programming guide
Visit Programiz for additional Python syntax examples and language reference