
CA 03 – Number Guessing Game Leaderboard (Python)
🎮 CA 03 – Number Guessing Game Leaderboard (Python) Hi All, In this task, I implemented a Leaderboard System for a Number Guessing Game using Python. 📌 Problem Statement Provide an option to view leaderboard details. Sort the leaderboard based on: Difficulty (Easy, Medium, Hard) Attempts (Ascending / Descending) 💡 Approach Used a list of dictionaries to simulate a database. Created separate functions: show_leaderboard() → to display data sort_leaderboard() → to sort data Used: sorted() function lambda expressions Custom mapping for difficulty sorting Implemented a menu-driven program for user interaction. 🗂️ Leaderboard Data leaderboard = [ { " name " : " manoj " , " difficulty " : " Easy " , " attempts " : 3 }, { " name " : " rahul " , " difficulty " : " Hard " , " attempts " : 7 }, { " name " : " anita " , " difficulty " : " Medium " , " attempts " : 5 } ] 📊 Display Leaderboard Function def show_leaderboard (): print ( " \n --- Leaderboard --- " ) for player in leaderboard : print (
Continue reading on Dev.to Python
Opens in a new tab




