Intermediate
Score a prompt and gate the change
Write score(model, prompt, cases) that calls model(prompt, text) for each (text, expected) in cases and returns the number of exact matches.
Write can_ship(best, new_score) that returns True when new_score is at least best, so a change that lowers the score is blocked.
What Check tests
- A good prompt scores 3 of 3
- A chatty prompt scores 0
scoreworks with any model function and an empty case listcan_shipallows equal or better scorescan_shipblocks a lower score
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.