Summary
I recorded this lecture to teach how to translate the Unix philosophy of small, single‑purpose tools into Python function design and to guide the implementation of a ticket‑ordering system for the Hurricane basketball team. I begin by defining the lab project's requirements: store game sections and dates as immutable tuples, apply pricing rules (base price, 1.5× rivalry multiplier, 20% student discount, 7% tax), and compute final costs. I emphasize that each function should encapsulate one responsibility, have clear inputs and outputs, and be reusable and unit‑testable. I demonstrate proper syntax (def, docstring, indentation, pass vs. return), the use of default arguments (e.g., students=False), and best practices such as avoiding mixing calculation logic with printing and adhering to DRY without over‑abstracting.
Next, I explain how functions receive arguments: positional arguments are matched by order, missing required arguments raise a TypeError, and keyword arguments allow out‑of‑order specification and improve readability. I introduce type hints for parameters and return values to aid static analysis, and show how tuple unpacking lets a single structured argument replace multiple related parameters. I contrast row‑wise (separate lists for each column) with columnar (list of tuples) data representations, noting that columnar storage can reduce memory and improve search performance for large datasets because only needed columns are loaded.
The key outcomes are a clear set of function signatures for the ticket system, an understanding of argument passing, and a decision to store game data columnarly for efficiency. The next steps are to implement the small, focused functions (price calculation, discount application, tax addition, and output formatting), write unit tests for each, and later explore variable scope as the next topic. By following these guidelines, I ensure that the resulting codebase is modular, maintainable, and aligned with the principles of composable Unix‑style tools.