Computer Science, asked by aantivenom, 1 year ago

Build a function retirement_age(PMT, i, FV, start_age) that calculates the (whole) age at which your customer can retire, if they:

invest an amount, PMT at the END of every YEAR (with the first payment made exactly one year from now),
at an interest rate of i% per year, compounded annually,
they require an amount of AT LEAST FV in order to be able to afford retirement and
they just turned start_age years old. Uisng Python Programming:Please help?

Answers

Answered by Raghav1330
0

Answer:

Output format

Enter principle amount.

1000

Enter interst rate

10

Enter desirable final amount

100000

Your current age 30

You can retire at 78

Explanation:

import math

def_Retirement_age(PMT, i, FV, start_age)

//conversion of interst rate to number from percentage

roi=i*0.01

// interim calculation for compound interest formula

val1= FV/PMT

val2=1+roi

//no of years from the formula

no of year = math.log10(val1) / math.log(val2)

return no_of_year

PMT= float (input ("enter the desired amount ")

start_age= int(input ("enter the age")

ret_age= round ( retirement_age(PMT, i, FV, start_age) + start_age)

print(" You can retire at the age of (ret_age)) ;

In this function at the beginning we take input on principal amount then read the starting amount from user. After taking the current age and desirable amount as input we calculate the retirement age by the function defined in ret_age prototype

Similar questions