Command Palette

Search for a command to run...

Hectal
Phase 13: Choosing and Adapting Models
LLM Engineering · Exercise 1 of 6Next
Intermediate

A weighted scorecard

Write total_score(candidate, weights) where candidate is a dict with the keys quality, cost_score and speed_score (all already on a 0 to 100 scale, higher is better) and weights is a tuple of three numbers in that order. It returns the sum of weight times score.

Write pick(candidates, weights) that returns the name of the candidate with the highest total. If two candidates tie, return the one listed first.

What Check tests

  1. total_score multiplies each score by its weight and adds
  2. Balanced weights pick the cheap, fast model
  3. Quality-first weights pick the stronger model
  4. A tie returns the first listed candidate

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.