FunctionRacerProblemsRace

Pass Rate by Class

EasypandasPython

results has columns cls, student and score. A student passes with a score of 50 or more. Return a dictionary mapping each class to the fraction of its students who pass, as a float.

Example 1

results {"cls":["a","a","b"],"student":["x","y","z"],"score":[80,40,50]}
returns {"a":0.5,"b":1.0}

a: 1 of 2 pass. b: 1 of 1.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems