Kodewick
Start learning →
Basic←→0 / 80

Fun run times

#045BasicSortingStrings5 min

Fun run results are written as "name:seconds", like "Mia:52". Write race_order(results) to return the names, fastest first. Seconds are whole numbers and all different; compare them as numbers (9 seconds beats 10). An empty list gives [].

Examples
race_order(["Mia:52", "Leo:48", "Ann:50"])→['Leo', 'Ann', 'Mia']
race_order([])→[]
main.py
def race_order(results):
    # your code here: take the seconds after the colon and turn them into an int to compare
    ordered = results
    return [r.split(":")[0] for r in ordered]
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.