A lightweight Python utility designed to aggregate tracked time (minutes and seconds) and calculate earnings based on an hourly rate.
When tracking freelance or contract work, time is often recorded in fragments of minutes and seconds. Manually converting these totals into exact decimal hours to calculate fair pay can be tedious and prone to rounding errors.
I built this project to automate that workflow. Unlike basic calculations that commpletely drop leftover minutes or round aggressively, this script converts the entire time tracking history down to the second, ensuring precise, to-the-penny compensationfor fractional hours worked.
- Precise Conversions: Leverages Python's built-in 'divmod()' function for clean, efficient time formatting.
- Fractional Pay Calculation: Ensures accurate compensation by calculating pay using exact decimal hours, not just whole hours.
- Zero Dependencies: Uses entirely vanilla Python with standard libraries-no external installations required.
The core function accepts two lists (one for minutes, one for seconds) and an optional hourly rate:
calculate_pay(minutes_list, seconds_list, rate=17)mins_list = [33, 36, 31, 37, 25, 49, 28, 33, 34]
secs_list = [29, 28, 12, 13, 52, 30, 28]
Your total time worked is 5 hours and 10 minutes.
Your total pay is $87.89
- Python 3.x (Built and tested using Python 3.12)
- No external libraries or virtual environments needed.
Simply clone the repository and run the script:
git clone [https://github.com/brendaSzu/pay-calculator.git](https://github.com/brendaSzu/pay-calculator.git)
cd pay-calculator
python pay_calculator.py
This utility is the foundational block for a larger, comprehensive financial tracking application. Future iterations will expand this script into a full-featured tool to help independent contractors manage their income.
- Persistent Storage: Integrating a local database (like SQLite) or data tracking framework to save multiple work sessions.
- Automated Tax Estimation: Building logic to calculate and maintain a running total of estimated quarterly taxes owed based on current tax brackets.
- Graphical User Interface (GUI): Wrapping the backend logic in a clean visual interface for seamless data entry and tracking.