Wednesday, November 18, 2025, last 60 minutes of class.
Labs 8–13, and all the associated readings in the Further Study sections.
In person, on paper.
Do each of the following to maximize your preparation:
Were you able to check off every box?
The fact that active recall is better for acquiring long-term knowledge does not mean that outlines and concept maps are not useful. Learners should use multiple techniques—think “both and” rather than “either or.”
Recursion
base case
recursive case
often you don’t need or want it, if a simple loop will do
if recursion is multi-way, it tends to shine more
(but be careful not to “overlap”—you will learn why in CMSI 2120)
recursion in nature and art (Fractals)
recursive structures
Classes
often better than dictionaries when representing ”things”
class definitions
__init__() method
self parameter
attributes
methods
Variables are necessary for sharing!
Dataclass are usually better! (__init__() is auto-generated)
Have to use the @dataclass decorator
Have to import dataclass from the dataclasses module
how to make objects immutable (and why it matters)
You can validate with __post_init__()
RGB Colors
RGB tuples
(0, 0, 0) is black
(255, 255, 255) is white
(255, 0, 0) is red
(0, 255, 0) is green
(0, 0, 255) is blue
other colors are combinations of red, green, and blue
Additional Python Programming Techniques
conditional expressions
integer division with //
why single recursion isn't always great
why multi-way recursion can be more powerful
raising exceptions
the various kinds of built-in exceptions
== vs. is
references
variable vs. objects
try and except for error handling
command line arguments with sys.argv
converting strings to integers with int()
input validation
list comprehensions
The exam is closed book, closed device, on paper, but you can bring in two sheets of paper with notes.
There will be 20 questions of the multiple choice, multiple select, fill-in-the-blank, and short answer variety. Here are the topic areas for each problem (and some actual questions too):
mystery(a) do? (That is, you will be given a function called mystery and you need to choose the answer that correctly says what the function does.)Person class without __str__ (what happens when you try to print an instance?)is_sibling_of__post_init__() method called?Card class)try and exceptTypeError and ValueError for various card constructions