Advanced
Search only the caller's documents
DOCS is a list of (tenant, text). Write search(tenant, word) that returns the list of texts that belong to tenant and contain word as a whole word (compare lower-case words from text.split()), in the original order.
Do not write a function that searches all tenants: the point is that there is no way to search without naming one. If tenant is empty or None, raise ValueError.
What Check tests
- Returns the tenant's matching documents in order
- Never returns another tenant's document
- Matches whole words, ignoring case
- A missing tenant is an error
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.