Question: In TODO 7 , you will implement the simulate _ account _ balance function. The function has the following parameters: - init _ principal: A
In TODO you will implement the simulateaccountbalance function. The function has the following parameters: initprincipal: A float indicating the initial principal balance. accrate: A float indicating the interest rate per year eg for acccmpfreq : An int indicating the number of times interest is applied per year. setupfee: A float indicating the amount of dollars that is deduced from the initprincipal when the account is set up you only deduct once years : An int indicating the number of years for which we would like to run the report. Based on the provided arguments, the function will print one or more lines each of which displays two values year number starting from and current balance on the account separated by a space. Let us go over the details of how the function works using the following example arguments: initprincipal: accrate : acccmpfreq: setupfee: years: after years. The last row should show the balance after the number of years specified under years or if the years argument is an odd number We suggest you implement the function in the following flow: Define a loop that executes years times assigning the year variable with the even numbers etc. HINT: Consider using the Python inbuilt range class. Within each iteration, compute the balance on the account using the function you implemented earlier and print the balance on the account rounded to decimal places. For example, for year we get the following line: # compoundinterest Year : # compoundinterest etc Be careful to properly account for the setupfee. Think carefully about the point in time when the fee is applied.
You are encouraged to validate your implementation by placing a call to the simulateaccountbalance function as;
simulateaccountbalance
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
