Never Top, Never Bottom
scores has columns exam, student and score, one row per student per exam they took. Return the names, in alphabetical order, of the students who never had the highest score of an exam and never had the lowest. Sharing the highest or the lowest score counts as having it.
Example 1
scores {"exam":[1,1,1,2,2,2,2],"student":["ann","bob","cy","ann","bob","cy","dee"],"score":[70,90,80,60,95,80,85]}
returns ["cy","dee"]
In exam 1 ann is lowest and bob highest. In exam 2 ann is lowest and bob highest again. cy and dee are never either.
Constraints
1 <= len(scores) <= 80
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Second SaleHard
- Teams Side by SideHard
- Three Month TotalsHard
- Winner of Each GroupHard
- Adult NamesBeginner
- Average AgeBeginner
- Biggest Daily JumpBeginner
- Cap the SalariesBeginner