beginner
Fixed-size Leaderboard
You’re building a local leaderboard for a game that tracks the all-time top 5 scores. Your task is to:
-
Write a function insert_score that:
- Takes a collection of scores and a new score.
- Inserts the new score in its correct sorted position (highest to lowest).
- Drops the lowest score if the collection was already full.
- If the new score is lower than everything already there, nothing changes.
-
Write a function print_scores that prints all scores.