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 @@ -27,7 +27,7 @@ Feel free to explore, learn, and share your own approaches.
- [x] **3/19:** [March Madness](https://github.com/codedex-io/daily-challenges/tree/main/march-2026/3-19-march-madness) 🏀
- [x] **3/20:** Cherry Blossoms 🌸
- [x] **3/21:** First Tweet 🐦
- [x] **3/22:** Water Day 💧
- [x] **3/22:** [Water Day](https://github.com/codedex-io/daily-challenges/tree/main/march-2026/3-22-water-day) 💧
- [ ] **3/23:** ❓❓❓
- [ ] **3/24:** ❓❓❓
- [ ] **3/25:** ❓❓❓
Expand Down
14 changes: 14 additions & 0 deletions march-2026/3-22-water-day/water-day.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def leaky_pipe(volume, leak, hours, threshold):
# for each passing hour
for i in range(hours):
# we calculate the new volume based on the formula
volume = volume * (1 - leak / 100)

# check if treshold
if volume < threshold:
# if volume less than threshold, it failed
return -1

# otherwise we return the new volume
# once the loop is over, rounded by 2 decimals
return round(volume, 2)