By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Complete the code challenge below. Read the instructions carefully and use the integrated editor on the right to write and run your solution.
Implement three small functions that turn a list of scores into a release verdict. This is the core of every gate you will ever write — and it needs no API key, no model and no network, which is exactly why it belongs in your suite as a fast deterministic test.
pass_rate(scores, threshold) → the share of scores at or above threshold, rounded to 2 decimals. An empty list returns 0.0.worst(scores, high_is_bad=False) → the smallest score, or the largest when high_is_bad is True (for metrics like latency or cost, where bigger is worse). An empty list returns 0.0.gate(scores, threshold, floor, min_mean) → "PASS" only when the mean is at least min_mean, the mean is at least threshold, and every score is at least floor. Otherwise "FAIL".Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.