Lists (1D and 2D)
- Stage
- 1
- Module
- M1.8
- Lessons
- 1
In this module
- Build and grow a list with a literal,
.append(), and a list comprehension. - Summarize a list with
sum(),sorted(),reversed(),any()andall(), and pair values withenumerate()andzip(). - Build a 2D grid of lists, and avoid the
[[0] * m] * naliasing bug that shares one row across every entry. - Recognize which list operations cost more as a list grows, and allocate
n + 1slots for a 1-indexed problem.
Before this module
Lessons
Practice
Try these on the judges. Each link opens the problem on WMOJ or DMOJ.
- 2026 J2Olympic Scores (opens on WMOJ in a new tab) WMOJ
Drop an athlete's highest and lowest judge scores, then scale what remains by a difficulty factor.
- 2023 J3Special Event (opens on WMOJ in a new tab) WMOJ
Find which day of the week has the most people available from a list of weekly schedules.
- 2016 J2Magic Squares (opens on DMOJ in a new tab) DMOJ
Check whether every row and column of a grid sums to the same value.
Why DMOJ: Tries the same kind of problem on DMOJ, which holds 2014 to 2020.