Week 5 – Python Programming Foundations

Objectives

  • Build core programming fluency with Python.
  • Write clean, testable functions and modules.
  • Handle common data processing tasks.
  • Manage Python dependencies and virtual environments effectively.

Topics

  • Python syntax, variables, control flow, and loops.
  • Functions, modules, and package structure.
  • Data structures (lists, dicts, sets, tuples).
  • File I/O and exception handling.
  • Intro to testing with pytest.
  • Virtual environments and isolation (venv, pipenv, poetry).
  • pip and PyPI: installing, pinning, and publishing packages.
  • pyproject.toml and dependency groups.
  • Lock files, reproducible installs, and vulnerability scanning with pip-audit.

Hands-On Activities

  • Implement command-line utility scripts.
  • Build a small data parser with validation.
  • Add unit tests for core functions.
  • Set up a project with a virtual environment, pinned dependencies, and a lock file.
  • Run a dependency audit and resolve a flagged vulnerability.

Deliverables

  • Python mini-project with tests.
  • README documenting usage and assumptions.
  • Reproducible dependency setup with pyproject.toml and lock file.

Assessment

  • Practical coding assignment and code review.