Passing Students
Imagine a results table where each student has a name and a score. Write a function count_passing that receives a dictionary where each key is a student name and each value is their score, plus a passing threshold threshold. Count students whose score is at least the threshold. Return that count.
Примеры
Ввод
{"a": 90, "b": 50, "c": 70}, 60Вывод
2Ввод
{}, 50Вывод
0Ввод
{"x": 100}, 100Вывод
1Нужно реализовать
def count_passing(scores: dict, threshold: int) -> int:
Теги
dicthashmap
Pieslēdzies, lai redzētu iesniegumu vēsturi
PieslēgtiesPieslēdzies, lai izmantotu AI mentoru
PieslēgtiesVisible tests
1
Input
{"a":90,"b":50,"c":70}, 60Expected
22
Input
{}, 50Expected
03
Input
{"x":100}, 100Expected
14
Input
{"a":1,"b":2,"c":3}, 5Expected
05
Input
{"a":60,"b":60}, 60Expected
26
Input
{"k":59}, 60Expected
0Focus radio
Paused · SomaFM · Fluid