Question: Use Python and give the code for both a and b by printing some output also which asked in question- Question- the second problem is

Use Python and give the code for both a and b by printing some output also which asked in question-

Question- the second problem is based on first problem

Both are inter related.

## Once retired, it would be important to know how much an account is changing because the account is still earning interest, but fixed payments are distributed from the retirement account to the retiree. To solve this problem, create a function named finallyRetired. This function has three arguments. The first is the amount of money in the retirement account. The second value is a list of the annual rates of return, and the third is the annual amount expensed to the retiree. When retiring, there is already an established principal, so there is interest earned every year in this solution. def finallyRetired(saved, v_rate, expensed): """ Describe what the function does, what type of information goes into the arguments, and what is returned. """

## How much can be spent from a retirement account every year to use all of the money? To answer this question, create a function named maximumExpensed. This function has five required arguments: salary, the percentage rate saved, a list of annual return rates while investing, a list of annual return rates while retired and a value for epsilon. The number of values in the list of annual return rates while investing represents the number of years worked. The number of values in the list of return rates while retired represents the years between retirement and bankruptcy (or when one might expect to pass on). def maximumExpensed(salary, p_rate, workRate, retiredRate, epsilon): """ Describe what the function does, what type of information goes into the arguments, and what is returned. """

Use the idea of binary searching to find a value for the amount expensed when retired so that the value of the retirement account is very close to zero. Keep in mind that it may be a negative number. (The values represent approximations of unrealized gains and losses, so overdrawing the account by a small amount is acceptable). Use the solution from problem two to determine the value saved. Likewise, use your solution to problem three to determine how much money remains at the end. While your function is searching for the solution, print the expensed and remaining value in a complete sentence to the console each time the expensed value changes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!