Created
May 11, 2023 18:16
-
-
Save metruzanca/4cdccca44e72a7641bbc14e006ecc842 to your computer and use it in GitHub Desktop.
Starting a new job in the middle of a calendar year? Want to max out employer contribution match? Use this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from datetime import date\n", | |
"\n", | |
"salary = int(input('Salary'))\n", | |
"employerMax = int(input('Contribution % to get max free money'))\n", | |
"today = date.today()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Assuming paychecks are semi-monthly\n", | |
"payCycles = 24\n", | |
"cyclesPerMonth = 2\n", | |
"remainingPayCycles = payCycles - (today.month - 1) * cyclesPerMonth - (today.day > 15)\n", | |
"\n", | |
"print('Remaining pay cycles: ' + str(remainingPayCycles))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"employerContributionTarget = salary * (employerMax/100)\n", | |
"employeeContributionPerCycle = employerContributionTarget / remainingPayCycles\n", | |
"employeeContributionPercentage = employeeContributionPerCycle / salary * 100 * 24\n", | |
"\n", | |
"\n", | |
"print(f'Employer contribution per cycle: {employeeContributionPerCycle} - {employeeContributionPercentage}%' )" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.11.3" | |
}, | |
"orig_nbformat": 4 | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment