d10 · Match whole-word terms (~4 min)
Parsing strings. Edit drills.py. Standard library only; no model calls, no API key.
def match_terms(query, text):
Return the query terms that appear in text as whole words.
Terms come from splitting query on any whitespace. Ignore case and surrounding
punctuation ("Refund?" matches "refund."). Whole words only: "cat" doesn't match
"category". Return terms lowercased, punctuation stripped, in query order, without
duplicates.
Failure messages are enough to go on, so leave the tests unread until you submit.