Intermediate
Normalise two score lists and mix them
Write min_max(scores): rescale a list to 0..1 with (score - lowest) / (highest - lowest). If all scores are equal, return a list of 0.0 of the same length.
Write mix(keyword, vector, alpha): normalise both lists with min_max, then return the list alpha * k + (1 - alpha) * v for each position.
What Check tests
- The best score becomes 1 and the worst 0
- Equal scores give zeros, not an error
- Alpha 1 keeps only the keyword list
- Alpha 0.5 mixes both normalised lists
- Raw scales do not leak through
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.