Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:** ❓❓❓
12 changes: 12 additions & 0 deletions march-2026/3-29-leaderboard-stats/leaderboard-stats.py
Original file line number Diff line number Diff line change
@@ -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)