Skip to content
CCC Python Course

Lookup tables

Stage
3
Module
M3.5
Lessons
1

In this module

  • Use a list or dictionary to map inputs to outputs.
  • Build a lookup table from problem data and query it quickly.
  • Avoid repeated computation by storing results in a lookup table.

Before this module

Lessons

  1. 1Lookup tables

Practice

Try these on the judges. Each link opens the problem on WMOJ or DMOJ.

  1. 2016 J4
    Arrival Time (opens on DMOJ in a new tab) DMOJ

    Look up an arrival time using a rule that changes across the day.

    Why DMOJ: A lookup-driven simulation, matching this lesson's table-first approach.

  2. 2024 S1
    Hat Circle (opens on WMOJ in a new tab) WMOJ

    Compare values at paired positions around a circular arrangement.

  3. 2023 J2
    Chili Peppers (opens on WMOJ in a new tab) WMOJ

    Look up a value for each item using a fixed table of entries.