Sort a Leaderboard

Each record has name and numeric score. Return the names sorted by score from highest to lowest; break score ties by name in ascending, case-sensitive order. Keep duplicate rows. Empty input returns an empty list.

Difficulty: beginner

Show hint

Use sort_values with by=["score", "name"] and ascending=[False, True]. Return the name column with tolist().

Examples

  • [[{"name":"Ben","score":90},{"name":"Asha","score":90},{"name":"Mina","score":95}]]["Mina","Asha","Ben"]

Your solution

Python · Pandas

Results

Python and Pandas load when you Run or Submit. Return a Python list, dictionary or scalar as requested.

Back to Lesson