Command Palette

Search for a command to run...

Hectal
Phase 11: RAG in Production
RAG and Vector Search · Exercise 1 of 5Next
Beginner

Measure index lag

Write index_lag(edited_at, indexed_at) taking two dicts (document id to tick) and returning a dict of document id to lag (indexed_at - edited_at) for every document that appears in both dicts.

Write late_docs(lags, allowed) returning the sorted list of document ids whose lag is greater than allowed.

What Check tests

  1. Computes the lag of each indexed document
  2. Leaves out documents that are not indexed yet
  3. Ignores indexed documents with no edit
  4. late_docs uses a strict comparison
  5. late_docs returns a sorted list

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.