diff --git a/README.md b/README.md index 213df0a..025250c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,6 @@ Feel free to explore, learn, and share your own approaches. - [ ] **3/26:** Flatten Array 🪜 - [ ] **3/27:** Infinite Monkey Theorem 🐒 - [ ] **3/28:** 28 Days Later 🧟 -- [ ] **3/29:** Leaderboard Stats 📊 +- [ ] **3/29:** [Leaderboard Stats](https://github.com/codedex-io/daily-challenges/tree/main/march-2026/3-29-leaderboard-stats) 📊 - [ ] **3/30:** ❓❓❓ - [ ] **3/31:** ❓❓❓ diff --git a/march-2026/3-29-leaderboard-stats/leaderboard-stats.py b/march-2026/3-29-leaderboard-stats/leaderboard-stats.py new file mode 100644 index 0000000..bc142f4 --- /dev/null +++ b/march-2026/3-29-leaderboard-stats/leaderboard-stats.py @@ -0,0 +1,12 @@ +def average_time(total, completed): + # first we split the time + time_parts = total.split(":") + + # then we define each time unit + hours, minutes, seconds = int(time_parts[0]), int(time_parts[1]), int(time_parts[2]) + + # now we calculate the total seconds + total_seconds = hours * 3600 + minutes * 60 + seconds + + # and we return the average + return round(total_seconds / completed) \ No newline at end of file