I need my output to start year till end year while outputting annual savings, interest savings, and total savings over time. I have all the calculations, but cannot figure out how to make it compound each subsequent year. My inputs are annual_savings, start_year, end_year, retirenment_year, and interest_rate. This is the for loop I have currently and its only outputting one row with incorrect calculations.
for i in range(start_year, end_year+1):
if current_year <= end_year:
add_save=ann_save
if current_year>end_year:
add_save=0
tot_save=ann_save+add_save
int_save=(tot_save+add_save)*(interest_rate/100)
print(current_year,ann_save,int_save,tot_save)
current_year=current_year+1