Course Content
Module 1 – Getting Started with Python
introduced the fundamentals of Python, giving beginners a clear understanding of how the language works and how to start writing simple programs. Python was highlighted as a beginner-friendly language with simple syntax, making it easy to read and write code.
0/7
Module 2 – Introduction to Python Programming
In this Introduction to Python module, learners explore Python’s clear, readable syntax and powerful features. Beginning with installation and a simple “Hello, World!” script, you will progress through variables, control flow and functions using step-by-step examples. By the end, you will be equipped to write your own Python programmes, automate routine tasks and tap into an extensive library ecosystem for real-world projects.
0/7
Basic Command for Command prompt, PowerShell, Zsh(macOS)
0/1
Module 3 – Variables, Data Types and Basic Operations
In the Variables, Data Types and Basic Operations in Python module, learners explore how to store and manage data using variables, master fundamental types such as integers, floats, strings and booleans, and perform arithmetic, comparison and logical operations step by step. Clear explanations, real world examples and hands on exercises guide you through writing and debugging code. By the end of this module, you will be ready to build dynamic Python programs and automate everyday tasks.
0/6
Module 4 – Control Flow – Conditions and Loops
Control flow structures determine the order in which your program’s code executes. With conditional statements, you can make decisions and execute certain code blocks only when specific conditions are met. Loops allow you to repeat actions efficiently without writing redundant code. In this module, we will explore fundamental control flow concepts in Python in a step-by-step manner, similar to Microsoft’s learning curriculum. By the end, you’ll understand how to use if, elif, and else statements (including nested conditions) for decision-making, how truthy and falsy values work in Boolean logic, how to construct for loops (using range() and iterating over collections), how to use while loops along with loop control statements (break and continue), and how to leverage list comprehensions and generator expressions for concise looping. Finally, we’ll apply these concepts in a practical exercise to build an interactive decision-making system. Each section below includes explanations, code examples, and mini-exercises to reinforce the concepts, all formatted for clarity and easy follow-along.
0/8
Day 1 Summary
We covered Modules 1, 2 & Module 3 (Lesson 1 & 2)
0/1
Module 5 – Functions and Code Organisation
Imagine you need to clean up a messy data set or send a personalised email to each customer. Instead of writing the same steps over and over, you can create a function and call it whenever you need. In this lesson on Functions and Code Organisation, you will learn how to define functions, pass and return information, document your work and group related code into modules for easy reuse and maintenance.
0/10
Day 2 Summary
Summary for Day 21 Aug 2025
0/1
Day 3 Summary
Summary of Day 28 Aug 2025
0/1
Module 7 – Working with Files and Folders
In this lesson, we will learn how to manipulate files and directories using Python. We’ll explore common file operations using the os module, and see how the pathlib module provides an object-oriented way to handle file paths. We’ll also use the glob module for pattern-based file searches and learn file I/O operations for text, CSV, and binary files. Additionally, we’ll introduce the calendar and time modules to work with dates and timestamps. Finally, an interactive lab will tie everything together by automating a folder backup and cleanup task. Follow the step-by-step sections below for each subtopic, try out the code examples, and explore the guided lab at the end.
0/9
Module 8 – Error Handling and Debugging Techniques
In this lesson, we will learn how to handle errors in Python programs and how to debug code effectively. Errors are inevitable, but knowing how to manage them ensures our programs don't crash unexpectedly. We will cover the difference between syntax errors and exceptions, how to use try, except, else, and finally blocks to catch and handle exceptions, and how to raise your own exceptions (including creating custom exception classes). We’ll also explore debugging strategies: using simple print statements or the logging module to trace your program’s execution, and using Python’s interactive debugger pdb to step through code. By following best practices for error handling and debugging, you can write resilient, maintainable code. Throughout this lesson, try the examples and exercises to practice these techniques.
0/9
Day 4 Summary
0/1
Module 9 – Automating Excel and PDFs with Python
In this lesson, you will learn how to automate common communication and reporting tasks using Python. We will cover sending notifications via email, messaging platforms, and SMS, as well as manipulating Excel spreadsheets and PDF files programmatically. Each section below includes step-by-step explanations, code examples, and interactive exercises to reinforce your understanding. By the end of this lesson, you’ll be able to send emails with attachments, integrate with Slack/Microsoft Teams, send SMS alerts, and automate Excel/PDF workflows.
0/9
Day 5 Summary
0/1
Mini Project: Build your own Automation Tool
The project incorporates two common automation tasks – Contact Management and Student Tasks Tracking
0/2
Day 6 Summary
0/1
Introduction to Python Programming (Copy 1)

Final Mini Project: Building a Modular Contact Manager in Python

Objectives

By the end of this project, you will be able to:

  • Define and call functions to manage contact records.
  • Use return properly to avoid unexpected None.
  • Document functions with docstrings.
  • Work with function arguments (default, keyword, *args, **kwargs).
  • Use lambda functions for sorting and filtering.
  • Organise code into modules and a package.
  • Follow PEP 8 style guidelines.
  • Run your code as a CLI app (python -m contact_manager).

Step 1 — Create Project Folder Structure

Make a new folder called contact_manager/. Inside it, create these files:

contact_manager/
    __init__.py
    contacts.py
    utils.py
    __main__.py
  • __init__.py → marks the folder as a package.
  • contacts.py → core functions (add, get, update, delete).
  • utils.py → helper functions (list, find).
  • __main__.py → CLI entry point.

Step 2 — contacts.py (Core Module)

File: contact_manager/contacts.py


"""
Core contact management functions with CSV file handling.
"""

import csv
import os

CONTACTS_FILE = "contacts.csv"

def load_contacts():
    contacts = {}
    if os.path.exists(CONTACTS_FILE):
        f = open(CONTACTS_FILE, mode="r", newline="", encoding="utf-8")
        reader = csv.DictReader(f)
        for row in reader:
            contacts[row["name"]] = {"phone": row["phone"], "email": row.get("email")}
        f.close()
    return contacts

def save_contacts(contacts):
    f = open(CONTACTS_FILE, mode="w", newline="", encoding="utf-8")
    fieldnames = ["name", "phone", "email"]
    writer = csv.DictWriter(f, fieldnames=fieldnames)
    writer.writeheader()
    for name, info in contacts.items():
        writer.writerow({"name": name, "phone": info["phone"], "email": info.get("email", "")})
    f.close()

def add_contact(name, phone, email=None):
    contacts = load_contacts()
    if name in contacts:
        raise KeyError(f"Contact '{name}' already exists.")
    contacts[name] = {"phone": phone, "email": email}
    save_contacts(contacts)
    return f"Contact '{name}' added successfully."

def get_contact(name) -> dict:
    contacts = load_contacts()
    try:
        return contacts[name]
    except KeyError:
        raise KeyError(f"Contact '{name}' not found.")

def update_contact(name, **kwargs):
    contacts = load_contacts()
    if name not in contacts:
        raise KeyError(f"Contact '{name}' not found.")
    record = contacts[name]
    if "phone" in kwargs:
        record["phone"] = kwargs["phone"]
    if "email" in kwargs:
        record["email"] = kwargs["email"]
    contacts[name] = record
    save_contacts(contacts)

def delete_contact(name):
    contacts = load_contacts()
    try:
        deleted = contacts.pop(name)
        save_contacts(contacts)
        return deleted
    except KeyError:
        raise KeyError(f"Contact '{name}' not found.")

Step 3 — utils.py (Helper Module)

File: contact_manager/utils.py


"""
Helper functions for querying and listing contacts using CSV file.
"""

from .contacts import load_contacts

def list_contacts(_unused, key="name"):
    """
    List contact names or full records sorted by a given key.
    """
    contacts_dict = load_contacts()
    if key == "name":
        return sorted(contacts_dict.keys())
    return sorted(
        contacts_dict.values(),
        key=lambda record: record.get(key) or ""
    )

def find_by_email(_unused, email, **kwargs):
    """
    Find all contacts matching a given email address.
    """
    contacts_dict = load_contacts()
    return [
        name
        for name, record in contacts_dict.items()
        if record.get("email") == email
    ]

Step 4 — init.py (Package Init)

File: contact_manager/__init__.py


"""
contact_manager package initialization.
"""

from .contacts import add_contact, get_contact, update_contact, delete_contact

Step 5 — main.py (CLI Entry Point)

File: contact_manager/__main__.py


"""
Command-line interface for contact_manager.
"""

import argparse
from .contacts import add_contact, get_contact, update_contact, delete_contact, load_contacts
from .utils import list_contacts, find_by_email

def _print_usage():
    usage = """
Usage:
    python -m contact_manager [command] [arguments]

Commands:
    add   [email]                   Add a new contact
    get                                    Get contact details
    update  [--phone PHONE] [--email EMAIL] Update phone and/or email
    delete                                 Delete a contact
    list [key]                                   List contacts (default key: 'name')
    find-by-email                         Find contacts by email
"""
    print(usage)

def main():
    parser = argparse.ArgumentParser(description="Contact Manager CLI")
    subparsers = parser.add_subparsers(dest="command")

    # Add command
    add_parser = subparsers.add_parser("add", help="Add a new contact")
    add_parser.add_argument("name")
    add_parser.add_argument("phone")
    add_parser.add_argument("email", nargs="?")

    # Get command
    get_parser = subparsers.add_parser("get", help="Get contact details")
    get_parser.add_argument("name")

    # Update command
    update_parser = subparsers.add_parser("update", help="Update contact")
    update_parser.add_argument("name")
    update_parser.add_argument("--phone")
    update_parser.add_argument("--email")

    # Delete command
    delete_parser = subparsers.add_parser("delete", help="Delete a contact")
    delete_parser.add_argument("name")

    # List command
    list_parser = subparsers.add_parser("list", help="List contacts")
    list_parser.add_argument("key", nargs="?", default="name")

    # Find-by-email command
    find_parser = subparsers.add_parser("find-by-email", help="Find contacts by email")
    find_parser.add_argument("email")

    args = parser.parse_args()

    try:
        if args.command == "add":
            print(add_contact(args.name, args.phone, args.email))

        elif args.command == "get":
            print(get_contact(args.name))

        elif args.command == "update":
            updates = {}
            if args.phone:
                updates["phone"] = args.phone
            if args.email:
                updates["email"] = args.email
            update_contact(args.name, **updates)
            print(f"Contact '{args.name}' updated.")

        elif args.command == "delete":
            deleted = delete_contact(args.name)
            print(f"Deleted contact: {deleted}")

        elif args.command == "list":
            print(list_contacts(None, args.key))

        elif args.command == "find-by-email":
            print(find_by_email(None, args.email))

        else:
            _print_usage()
    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    main()

Step 6 — Run the Project

From the parent folder (where contact_manager/ exists), run commands:

python -m contact_manager add Alice 12345 alice@mail.com
python -m contact_manager add Bob 55555 bob@mail.com
python -m contact_manager list
python -m contact_manager get Alice
python -m contact_manager update Alice --phone 98765
python -m contact_manager delete Bob
python -m contact_manager find-by-email alice@mail.com