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
- Computes the lag of each indexed document
- Leaves out documents that are not indexed yet
- Ignores indexed documents with no edit
- late_docs uses a strict comparison
- 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.