python/RMD_Calculator.py

34 lines
1.1 KiB
Python

def calculate_rmd(balance, age):
"""
Calculates the Required Minimum Distribution (RMD)
using the IRS Uniform Lifetime Table.
Parameters:
- balance (float): IRA balance on Dec 31 of the prior year
- age (int): age as of the distribution year
Returns:
- rmd (float): calculated RMD
"""
# Life expectancy factors from the IRS Uniform Lifetime Table (selected ages)
uniform_lifetime_table = {
73: 26.5, 74: 25.5, 75: 24.6, 76: 23.7, 77: 22.9,
78: 22.0, 79: 21.1, 80: 20.2, 81: 19.4, 82: 18.5,
83: 17.7, 84: 16.8, 85: 16.0
# Add more ages if needed
}
if age not in uniform_lifetime_table:
raise ValueError(f"No factor found for age {age}. Please check IRS table.")
factor = uniform_lifetime_table[age]
rmd = balance / factor
return round(rmd, 2)
# Example usage
ira_balance = 100000 # Replace with actual Dec 31 balance for the prior year
age = 73 # Replace with your age as of the distribution year
rmd_amount = calculate_rmd(ira_balance, age)
print(f"Your RMD for age {age} is: ${rmd_amount}")