Back to articles
Building a Leaderboard for a Number Guessing Game using Selection Sort

Building a Leaderboard for a Number Guessing Game using Selection Sort

via Dev.to PythonSri Mahalakshmi

Introduction What is a Number Guessing Game? A number guessing game is a simple game where: The system generates a random number The player tries to guess that number The system gives hints like: "Too high" "Too low" The game continues until the correct number is guessed How Performance is Measured The number of attempts taken by a player is recorded The difficulty level (Easy, Medium, Hard) may also be chosen In a number guessing game, just finding the correct number is not enough. We also need to compare players and rank them based on their performance. This can be done using a leaderboard system , where players are sorted based on: Difficulty level Number of attempts Problem Statement The task is to: Show the leaderboard details Sort the leaderboard based on: Difficulty (Easy → Medium → Hard) Attempts (less attempts = better rank) Example Input Alice Hard 7 Bob Easy 3 Charlie Medium 5 David Easy 2 Expected Output David Easy 2 Bob Easy 3 Charlie Medium 5 Alice Hard 7 Concept Used: Se

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
6 views

Related Articles