runtime
96 / 500
question 96 Fundamentals Integration · medium

The podium is in alphabetical order

podium(results, places=3) should return the names of the fastest runners, fastest first. Results are (name, seconds) tuples. Runners with the same time are listed alphabetically. Right now it returns names in alphabetical order whatever their times, and after calling it the organisers' results list has been reshuffled. Fix both problems.

Functionpodium(results, places=3)
resultsa list of (name, seconds) tuples
Returnsa new list of up to places names, lowest time first; equal times in alphabetical order
Must notchange results
Examples
callpodium([('Ana', 1520), ('Ben', 1475), ('Chen', 1610), ('Dara', 1475), ('Eli', 1502)])returns['Ben', 'Dara', 'Eli']
callpodium([('Ana', 1520), ('Ben', 1475), ('Chen', 1610), ('Dara', 1475), ('Eli', 1502)], 1)returns['Ben']
callpodium([('Zed', 900), ('Amy', 950)])returns['Zed', 'Amy']

Loading your progress…

The podium is in alphabetical order — Python practice · Runtime