← back to unit
Medium
# breaking it down medium
Library Late Fees
The library's mercy rules: the first 5 late days cost 1 coin each, every day after costs 2 coins — but no single book ever costs more than 20 coins. 📚
You get the days each book is overdue (0 means on time). Print the total fee for the whole pile.
Example:
Input: days = [3, 7, 0]
Output: 12
3 late days cost 3 × 1 = 3; 7 late days cost 5×1 + 2×2 = 9; 0 days costs nothing — total 3 + 9 + 0 = 12.
💡 need a hint?
brk-late-fees.py🔒 given lines are locked — write your code in between
loading...