Week 1: Python Fundamentals & Data Structures
From syntax to data structures, OOP, and scripting patterns — the Python skills every data scientist needs from day one.
- Write Python functions, classes, and modules
- Use list/dict comprehensions for concise data processing
- Understand Python's data structures and when to use each
- Read and write files, handle exceptions, and use virtual environments
This first lecture establishes the foundational framework for Python Programming. By the end of this session, you will have the conceptual grounding and practical starting point needed for the rest of the course.
Key Concepts
The lecture introduces the four main pillars of this course: Variables, Types & Control Flow, Functions & Lambda, OOP: Classes & Inheritance, File I/O & Exception Handling. Each will be explored in depth over the 14-week curriculum, with hands-on projects reinforcing theory at every stage.
This Week's Focus
Focus on mastering: Variables, Types & Control Flow and Functions & Lambda. These are the prerequisites for everything in Week 2. The concepts build on each other — do not skip the practice exercises.
PROG101 Project 1: Data Processing CLI Tool
Build a command-line Python tool that reads a CSV file, performs filtering and aggregation based on user arguments, and outputs formatted results. Must include proper error handling.
- Python CLI script with argparse
- CSV reading and processing with pure Python or pandas
- At least 3 data operations (filter, aggregate, sort)
- Unit tests for core functions (pytest)
These represent the style and difficulty of questions you'll see on the midterm and final. Start thinking about them now.
What is the difference between a Python list and a tuple? When would you prefer each?
Explain what a generator is and why it is memory-efficient compared to a list.
Write a Python class `DataRecord` with `__init__`, `__repr__`, and a method `to_dict()`.