Command Palette

Search for a command to run...

Hectal
Phase 12: Advanced Patterns
RAG and Vector Search · Exercise 1 of 5Next
Beginner

Children to parents

Hits are (child_id, score) pairs, best first, and a child id looks like D50.2 (the parent id is the part before the dot).

Write parents_for(hits, min_score): ignore hits whose score is below min_score, map each remaining hit to its parent id, remove repeats and keep the order of first appearance. Return the list of parent ids.

What Check tests

  1. Children map to their parents
  2. Repeats are removed
  3. Order of first appearance is kept
  4. Weak hits are ignored
  5. No hits gives an empty 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.