Question
# # Problem 1 # def retFund(salary, save, growthRate, years): - salary: the amount of money you make each year. - save: the percent
# # Problem 1 #
def retFund(salary, save, growthRate, years): """ - salary: the amount of money you make each year. - save: the percent of your salary to save in the investment account each year (an integer between 0 and 100). - growthRate: the annual percent increase in your investment account (an integer between 0 and 100). - years: the number of years to work. - return: a list whose values are the size of your retirement account at the end of each year. """ # TODO: Your code here.
def testRetFund(): salary = 10000 save = 10 growthRate = 15 years = 5 savingsRecord = retFund(salary, save, growthRate, years) print (savingsRecord) # Output should have values close to: # [1000.0, 2150.0, 3472.5, 4993.375, 6742.3812499999995]
# TODO: Add more test cases here.
Objective:
Write a function, called retFund, which takes four arguments: a salary, a percentage of your salary to save in an investment account, an annual growth percentage for the investment account, and a number of years to work. This function should return a list, whose values are the size of your retirement account at the end of each year, with the most recent years value at the end of the list. Complete the implementation of: def retFund (salary, save, growthRate, years): Write your code in the appropriate place in the template a6_1.py. To test your function, run the test cases in the test function testRetFund(). You should add additional test cases to this function to further test your code. This first model is pretty simple. Clearly, the market does not grow at a constant rate. So a better model would be to account for variations in growth percentage each year.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started