Computer Programming with Python (under construction)

Computer Programming with Python M 20 P (Fall 2025 @ UCLA)

An introduction to computer programming and computational thinking with a focus on the Python 3 language. The course starts from first principles—variables, branching, loops—and advances to object-oriented design, algorithmic efficiency, and practical software engineering techniques such as testing and debugging. Key programming concepts include basic data types, control structures, input/output, functions, recursion, and object-oriented programming with an emphasis on Python-based data structures, writing efficient, modular code and testing/debugging techniques.

Examples and exercises are drawn from engineering, mathematics, and the physical sciences to ground abstract concepts in real-world problem solving. Instruction blends mini-lectures, live-coding sessions, and hands-on notebook exercises to ensure students leave each class with runnable code and a clear mental model of how it works.

Course Logistics

  • Structure & Workload:
    Lecture · 2 h / week | Discussion · 2 h / week | Laboratory · 2 h / week | Outside study · ≈ 6 h / week
  • Prerequisite: Mathematics 33A
  • Grading: Letter
  • Class Time: TBA
  • Location: TBA (in person) | Zoom
  • Office Hours: TBA | Zoom
    Q&A hosted on Piazza

Course Websites

Syllabus PDF

Download the full syllabus (PDF)

Main Texts & References

  1. Think Python (3rd ed.) – Allen Downey (Free Online)
  2. Introduction to Computation & Programming Using Python – John Guttag

Other Texts & Broader references (Mostly Free Online)

  1. How to Solve It - George Pólya (Read this summary!)
  2. Python Data Science Handbook (2nd ed.) – Jake VanderPlas
  3. Introduction To Computer Science And Programming In Python - MIT OpenCourseWare

Course Schedule (Tentative)

Date Topic Lab Exercises
(Think Python 3e)
Prerequisite Lecture notes/slides* Resources / Extra Reading
Lecture 1 Course logistics • Programming mindset
Syntax, variables, types, operators, Basic I/O, code style
Variables & control-flow drill + mini-debug (pdb watch-list) Ch 01 & 02 Math 33A Guttag Ch 1;
Python tutorial (official),
PEP 8 style guide,
Turing Machine
Lecture 2 Branching and conditionals, loops, ranges; Comparison/Boolean Operators; Data structures:lists, tuples;list comprehensions Array exercises
Loop-based problem solving (max, sum, reverse)
off-by-one error debuging
Ch 06 (Iteration)  + Ch 08 (Lists)
§03.12 list-comprehension *peek*
Basic program structure Guttag Ch 2-3;
LearnPython .org interactive
Real Python • Loops
Python docs – lists & tuples
Lecture 3 Functions, scopes, *args/**kwargs, iterables, map, lambda function Modular design & Ch 03 (Functions) & Ch 05 §5.1-5.4 (Fruitful funcs)
*Skip recursion parts until L6*
Branching & loops Guttag Ch 4 & 8;
Real Python • Defining functions
*args & **kwargs explained
Python docs – __main__
pytest intro
Lecture 4 Recursion & problem decomposition • Sorting (built-in & custom) • Searching (linear / binary)
Root-finding (bisection) • Big-O basics
Sort/search challenges + timing decorator (simple profiler) + Matplotlib multi-plot demo Ch 05 §5.5-5.9 (Recursion) & Ch 13 §13.3-13.6 (Search & Selection) Dictionaries & files Guttag Ch 11, 14-15;
Big-O Cheat Sheet
Visual Algo • Search animations
GfG sorting/search practice
Lecture 5 Dictionaries, sets, mutability vs hashability
Hash-based problem solving (freq maps, memoisation)
Strings review; Anagrams & hashmap puzzles (with logging) Ch 07 (Strings review) & Ch 09 (Dictionaries)
Ch 10 §10.2-10.4 (Tuples vs lists)
Functions & testing Guttag Ch 5 & 7;
Python Tutor visualizer
Real Python • Dictionaries
Real Python • Sets
Lecture 6 File I/O (text, CSV, JSON);
Script execution (if __name__ == "__main__"); Modules & packages
Defensive programming: try/except, assertions, basic debugging
File parsing + input validation + Unit testing basics + TDD (pytest markers + assert patterns)
Mini-lab: NumPy & Pandas warm-up (CSV → DataFrame) + Quick intro to Matplotlib: plot CSV columns
Ch 11 (Files & Exceptions) & Ch 12 (Modules) Sequences overview Guttag Ch 6, 8-9;
Automate the Boring Stuff – Ch 10-11
Real Python • File I/O
Matplotlib getting started
NumPy quickstart
Pandas I/O guide
Lecture 7 OOP I: Classes, constructors, encapsulation, __str__/__repr__
Data Structures I: Stacks, queues, priority queues (heapq)
Interview patterns: balanced parentheses, sliding-window max
Stack/queue/heap drills + class-based simulation (with doctest) Ch 14 & 15 (Classes & Objects) Recursion & complexity Guttag Ch 10 & 13;
heapq docs
Real Python • Stacks & Queues
LeetCode stack practice
Lecture 8 OOP II: Inheritance, polymorphism, abstract base classes
Data Structures & Graph Algorithms: adjacency lists, DFS, BFS, shortest path, memoisation
Dynamic Programming intro
Graph problems (maze reachability, shortest path) + inheritance refactor Ch 17 (Inheritance) & Ch 18 §18.1-18.3 (Simple DP) OOP concepts Guttag Ch 12 & 15;
NetworkX docs
Khan Academy • Graph intro
CP-Algorithms • Graph guide
Lecture 9 Testing & Debugging Deep-Dive: pytest fixtures, coverage, pdb, logging config, profiling
Exception hierarchies, input validation patterns
End-to-end debugging workflow on prior homework Appendix B (Debugging) & Ch 11 §11.4 (try/except) Algorithm analysis Guttag Ch 8-9;
pdb tutorial (Real Python)
Logging How-To
pytest usage guide
Lecture 10 Capstone: Data analysis pipeline, advanced visualization, intro ML (scikit-learn glimpse)
Project wrap-up & interview-style review
Pandas + NumPy project support, mock tech-interview round-robin Ch 19 (Case study: Data analysis) All prior material Guttag Ch 23-26;
Pandas intro tutorials
scikit-learn basic tutorial
Real Python • Data science pipeline
  • Part of the lecture materials are adapted from the cited references and will be available on the course website as we progress through the course.

Grading Policy

  • Weekly Problem Sets (7)30 %
    Released each Friday, due the following Thursday at 11:59 pm ET--Canvas submission.
  • Exercises20 %
    The completed and compiled Jupyter notebook (including the exercises)--Canvas submission. Due the midnight before each class (Wednesdays 11:59pm)
  • Check-in Quizes&Participation 20 %
    Quize is based on last lecture. Attendance, discussion, Piazza/Ed posts, peer-citation, and peer-code reviews.
  • Final (Individual) Capstone Project30 %
    (1) Analysis, (2) simulation, and (3) code documentation will be due on date:TBA. Collaborations are highly encouraged based on "Collaboration Policy"--Canvas submission.

Letter-grade bands: A ≥ 93, A- ≥ 90, B+ ≥ 87, B ≥ 83, B- ≥ 80, C+ ≥ 77, C ≥ 73, C- ≥ 70, D ≥ 60, F < 60.

Late Policy: Late submissions are not accepted. If you are unable to submit on time due to a valid reason, please contact me at least 48 hours before the deadline to discuss possible accommodations.

Collaboration Policy: Discuss concepts freely, but all submitted code and write-ups must be your own. You must also cite precisely and in detail any external resources or generative-AI assistance used.