MPCS 51042 - Python Programming
Python is one of the most commonly used programming languages today, dominating a wide range of sectors. It is a language designed to be easy to learn that emphasizes readable code via powerful and extensible syntax. This course provides a thorough overview of the Python language with an emphasis on writing idiomatic code.
This course aims to:
- Build general-purpose programming skills. From thinking about decomposing problems into parts to thoughtful choices of data structures and algorithms.
- Emphasize Python’s strengths as a multi-paradigm language by exploring procedural, functional, and object-oriented styles.
- Introduce the powerful ecosystem of Python libraries, and encourage continued growth as a Python programmer.
This course will cover:
- Python Basics: types, variable, operations, control flow, iteration
- Functions: including scope rules, functional programming constructs, recursion, and generators
- Object-Oriented Programming in Python: classes, dynamic attributes, operators
- Data structures in Python (lists, stacks, hash tables, queues, trees)
- Modules, packages, and the broader Python ecosystem
- A brief introduction to scientific computing in Python
Quick Links
- Ed Discussion
- Lecture Notes
- Course Policies - Academic Honesty, AI, Accessibility, Code of Conduct, Diversity, Late, and Regrade policies.
- Common Grade Deductions
- Getting Help
- Using pytest
- CS Student Resource Guide
Readings
While there are no required textbooks for this course, I provide suggested readings from the following books.
I’d highly recommend picking up one of these, there is no need to get both:
- Python Distilled (1st Edition), by David Beazley (PD)
- Learning Python (5th Edition), by Mark Lutz (LP)
Additionally, these books may be useful to further explain concepts discussed in this course:
- Fluent Python (2nd Edition), by Luciano Ramalho (1st Edition OK)
- Python in a Nutshell (3rd Edition), by Martelli, Ravenscroft, and Holden
Office Hours
Regular office hours start Week 2, unless otherwise indicated.
| Who | Where | When |
|---|---|---|
| Kaed Esposo | JCL Common Area 3D | Tuesday 9-11am |
| James Turk | JCL 352 | Wednesday 11am-noon |
| Christine Tsai | JCL Common Area 3B | Wednesday 1-3pm |
| Shuyang Qian | JCL Common Area 3A | Thursday 8-10am |
| Adi Suresh | JCL Common Area 3D | Thursday 4-6pm |
| James Turk | https://jpt.sh/l/zoom/ | Friday 1-2pm |
In addition to drop-in hours, James also has openings for appointments available: https://cal.com/jamesturk/office-hours
Please note that these are limited and are shared between multiple classes. Please be considerate in your usage and favor the drop-in office hours for help on assignments.
Course Schedule
Meets Tuesdays 2:00 pm - 4:50 pm @ JCL 011.
Week 1
Coursework
- PA #0 Released
Week 2
Coursework
- PA #0 Due
- PA #1 Released
- Quiz #1
Week 3
Coursework
- PA #1 Due
- PA #2 Released
- Quiz #2
Week 4
Coursework
- PA #2 Due
- PA #3 Released
- Quiz #3
Week 5
Coursework
- PA #3 Due
- PA #4 Released
- Quiz #4
Week 6
Coursework
- PA #4 Due
- PA #5 Released
- Quiz #5
Week 7
Coursework
- PA #5 Due
- PA #6 Released
- Quiz #6
Week 8
Coursework
- Quiz #7
Thanksgiving Week
nothing due
Week 9
TBD (Special Topics)
Coursework
- PA #6 Due
- Quiz #8 (cumulative)
Finals Week
Final Exam on Tuesday during normal class time
Programming Assignments
There will be 7 programming assignments, released Weeks 1-8.
Note: The final assignment, PA #6, is larger than the others and worth more points.
All programming assignments in this course will be distributed via GitHub and submitted via Gradescope. Assignments are intended to be completed without any generative AI assistance of any kind. Use of generative AI will result in a zero on the entire assignment and be reported to the department for further action.
Working on an Assignment
Install dependencies. Once the assignment is checked out, first run
uv sync. This will ensure that you have the necessary packages for this project, details will be discussed in class.Read the instructions carefully - Make sure you understand what you’re being asked to do before you start writing code. If you’re not sure, ask for clarification.
Check in often - Check your code into git and push to GitHub regularly. This will help you avoid losing work if something goes wrong with your machine.
Run the tests - The tests are there to help you. If you’re not sure if your code is correct, run the tests and see if they pass. If they don’t, read the error messages carefully - they may give you a hint as to what’s wrong.
Experiment in the REPL - If you’re not sure how a particular function or method works, try it out in the REPL (
python3oripython). A major advantage of interpreted languages is this ability to experiment interactively.Ask questions of course staff - If anything is not clear, ask questions via Ed! If you are stuck or need help with a concept, office hours may be a good idea as well! See Getting Help for more advice on how to ask for help.
Use a Linter.
ruffwill be introduced and is recommended. Using it (or a linter of your choice) in this course will let you focus on the actual problem, help you write cleaner code, and detect common issues that may result in a lower grade.
Grading
We will be using a form of specifications grading in this course. The goal of specifications grading is to help students focus on their mastery of the material and identify areas for improvement as the quarter progresses.
Shorthand: focus on skills, not scores.
Each assignment will have a set of specifications totalling 10-20 points. For example:
| Specification | Points |
|---|---|
| Problem 1 Tests | 2 |
| Problem 2 Tests | 2 |
| Problem 2 Correctness | 2 |
| Problem 3 Tests | 2 |
| Problem 3 Correctness | 2 |
| Code Quality | 2 |
| Total | 12 |
The typical components of an assignment may include:
- Tests: Passing all tests will earn full points, passing more than half the tests will earn half points.
- Code Quality: A grader will review some of your code for adherence to style guidelines and best practices. Small issues will lead to a half point deduction, significant issues earn a zero.
- Correctness: A grader will review some of your code for correct use of Python’s features as described in the assignment.
Points will vary based on complexity and occasionally an assignment will have a unique criteria which will be explained in the assignment as needed.
Resubmissions
You will be allowed to resubmit one programming assignment (PA #0-6, there will not be time to resubmit PA #7).
This means that, if you produce work that needs some improvement, you will have a chance to address the grader’s feedback to improve your score on that assignment.
Your resubmission will be due by Week 9, details will be shared via Ed later in the quarter.
The procedure for resubmissions will be shared via Ed.
Quizzes
There are 8 quizzes given in class Weeks 2-9. These serve two purposes:
Give you a chance to practice on the kinds of questions on a paper programming exam. (useful for the final or interviews)
Allow you to ensure that you are retaining the important concepts, and not overly relying on LLMs or similar when solving problems.
Each quiz will be worth between 10-20 points, with a total of 100+ points available throughout the quarter.
These scores are for primarily your own benefit, there is no penalty for doing poorly or even not taking the quizzes. As such, make-ups will only be available in exceptional circumstances.
Final Exam
A final exam will be given in Week 10/finals week. It will be similar in length and form to a combination of the quizzes.
Final Grade
First, we will take the sum of your top 7 quiz scores: quiz_points.
The higher of this score and your exam_points will then be averaged with your pa_points:
quiz_points = sum(quiz_scores) - min(quiz_scores)
total_points = (pa_points + max(quiz_total, exam_points)) / 2
This means that if your quiz total is high enough, you may opt not to take the final at all. This is entirely your choice.
This numeric score will convert to a letter grade according to the following:
| Minimum | Letter |
|---|---|
| 95 | A |
| 90 | A- |
| 87 | B+ |
| 83 | B |
| 80 | B- |
| 77 | C+ |
| 73 | C |
| 70 | C- |
Academic Honesty Violations
The minimum penalty for an academic honesty violation is a 0 on the entire assignment in question.
You may not use a regrade on an assignment flagged for an academic honesty violation.
Additionally:
- If you receive one violation in this class, your letter grade will be capped at a B. Many MPCS courses and scholarships require a B+, and this will disqualify you from those.
- A second violation in this class will result in an F.
There will be no exceptions to this policy.
Curving
In lieu of traditional curving, I reserve the right to lower the thresholds for each grade.
I will not raise the thresholds. (So if you earn an A- according to the above chart, you will get an A- or better.)