Kodewick
Start learning →
Basic←→0 / 100

Top three

#052BasicLists4 min

The game's leaderboard only shows the top three. Write top_three(scores) to return the 3 highest scores, highest first. With fewer than 3 scores, return all of them, highest first.

Examples
top_three([300, 950, 120, 700])→[950, 700, 300]
top_three([40, 80])→[80, 40]
main.py
def top_three(scores):
    ranked = sorted(scores)
    # your code here: highest first, then the first 3
    return ranked
Ctrl + Enter runs too
Result

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